Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AKPlanning
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KIF
AKPlanning
Commits
e48b72af
Commit
e48b72af
authored
4 years ago
by
Benjamin Hättasch
Committed by
Nadja Geisler
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add link to AK details page to AKSlot change form
parent
e5193002
No related branches found
No related tags found
1 merge request
!77
Add link to AK details page to AKSlot change form
Pipeline
#9294
passed
4 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
AKModel/admin.py
+10
-1
10 additions, 1 deletion
AKModel/admin.py
with
10 additions
and
1 deletion
AKModel/admin.py
+
10
−
1
View file @
e48b72af
...
...
@@ -7,7 +7,9 @@ from django.shortcuts import render
from
django.urls
import
path
,
reverse_lazy
from
django.utils
import
timezone
from
django.utils.html
import
format_html
from
django.utils.safestring
import
mark_safe
from
django.utils.translation
import
gettext_lazy
as
_
from
rest_framework.reverse
import
reverse
from
simple_history.admin
import
SimpleHistoryAdmin
from
AKModel.availability.forms
import
AvailabilitiesFormMixin
...
...
@@ -212,7 +214,7 @@ class AKSlotAdmin(admin.ModelAdmin):
list_editable
=
[
'
ak
'
,
'
room
'
,
'
start
'
,
'
duration
'
]
ordering
=
[
'
start
'
]
readonly_fields
=
[
'
updated
'
]
readonly_fields
=
[
'
ak_details_link
'
,
'
updated
'
]
def
get_urls
(
self
):
urls
=
super
().
get_urls
()
...
...
@@ -242,6 +244,13 @@ class AKSlotAdmin(admin.ModelAdmin):
kwargs
[
'
initial
'
]
=
Event
.
get_next_active
()
return
super
(
AKSlotAdmin
,
self
).
formfield_for_foreignkey
(
db_field
,
request
,
**
kwargs
)
def
ak_details_link
(
self
,
akslot
):
if
apps
.
is_installed
(
"
AKScheduling
"
)
and
akslot
.
ak
is
not
None
:
link
=
f
"
<a href=
{
reverse
(
'
submit
:
ak_detail
'
, args=[akslot.event.slug, akslot.ak.pk])
}
>
{
str
(
akslot
.
ak
)
}
</a>
"
return
mark_safe
(
link
)
return
"
-
"
ak_details_link
.
short_description
=
_
(
'
AK Details
'
)
@admin.register
(
Availability
)
class
AvailabilityAdmin
(
admin
.
ModelAdmin
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment