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
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
Aaron -
AKPlanning
Commits
26fcb937
Commit
26fcb937
authored
5 years ago
by
Benjamin Hättasch
Browse files
Options
Downloads
Patches
Plain Diff
Add filters for category and wish for AK admin view
parent
73da0462
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
AKModel/admin.py
+23
-0
23 additions, 0 deletions
AKModel/admin.py
AKModel/locale/de_DE/LC_MESSAGES/django.po
+36
-24
36 additions, 24 deletions
AKModel/locale/de_DE/LC_MESSAGES/django.po
with
59 additions
and
24 deletions
AKModel/admin.py
+
23
−
0
View file @
26fcb937
from
django.contrib
import
admin
from
django.contrib.admin
import
SimpleListFilter
from
django.db.models
import
Count
,
F
from
django.shortcuts
import
render
from
django.utils.translation
import
gettext_lazy
as
_
...
...
@@ -15,10 +17,31 @@ admin.site.register(AKTag)
admin
.
site
.
register
(
AKRequirement
)
class
WishFilter
(
SimpleListFilter
):
title
=
_
(
"
Wish
"
)
# a label for our filter
parameter_name
=
'
wishes
'
# you can put anything here
def
lookups
(
self
,
request
,
model_admin
):
# This is where you create filter options; we have two:
return
[
(
'
WISH
'
,
_
(
"
Is wish
"
)),
(
'
NO_WISH
'
,
_
(
"
Is not a wish
"
)),
]
def
queryset
(
self
,
request
,
queryset
):
annotated_queryset
=
AK
.
objects
.
annotate
(
owner_count
=
Count
(
F
(
'
owners
'
)))
if
self
.
value
()
==
'
NO_WISH
'
:
return
annotated_queryset
.
filter
(
owner_count__gt
=
0
)
if
self
.
value
()
==
'
WISH
'
:
return
annotated_queryset
.
filter
(
owner_count
=
0
)
return
queryset
class
AKAdmin
(
admin
.
ModelAdmin
):
model
=
AK
list_display
=
[
'
name
'
,
'
short_name
'
,
'
category
'
,
'
is_wish
'
]
actions
=
[
'
wiki_export
'
]
list_filter
=
[
'
category
'
,
WishFilter
]
def
is_wish
(
self
,
obj
):
return
obj
.
wish
...
...
This diff is collapsed.
Click to expand it.
AKModel/locale/de_DE/LC_MESSAGES/django.po
+
36
−
24
View file @
26fcb937
...
...
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-10-30 1
1:56
+0000\n"
"POT-Creation-Date: 2019-10-30 1
3:18
+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
@@ -11,17 +11,29 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: admin.py:33
#: admin.py:21
msgid "Wish"
msgstr "AK-Wunsch"
#: admin.py:27
msgid "Is wish"
msgstr "Is ein Wunsch"
#: admin.py:28
msgid "Is not a wish"
msgstr "Ist kein Wunsch"
#: admin.py:53
msgid "Export to wiki syntax"
msgstr "In Wiki-Syntax exportieren"
#: availability.py:38 models.py:30 models.py:51 models.py:103 models.py:121
#: models.py:152 models.py:201 models.py:23
3
models.py:2
59
#: models.py:152 models.py:201 models.py:23
7
models.py:2
63
msgid "Event"
msgstr "Event"
#: availability.py:39 models.py:52 models.py:104 models.py:122 models.py:153
#: models.py:202 models.py:23
4
models.py:26
0
#: models.py:202 models.py:23
8
models.py:26
4
msgid "Associated event"
msgstr "Zugehöriges Event"
...
...
@@ -33,7 +45,7 @@ msgstr "Person"
msgid "Person whose availability this is"
msgstr "Person deren Verfügbarkeit hier abgebildet wird"
#: availability.py:56 models.py:2
37
models.py:25
2
#: availability.py:56 models.py:2
41
models.py:25
6
msgid "Room"
msgstr "Raum"
...
...
@@ -41,7 +53,7 @@ msgstr "Raum"
msgid "Room whose availability this is"
msgstr "Raum dessen Verfügbarkeit hier abgebildet wird"
#: availability.py:65 models.py:205 models.py:25
1
#: availability.py:65 models.py:205 models.py:25
5
msgid "AK"
msgstr "AK"
...
...
@@ -68,7 +80,7 @@ msgid "Availabilities"
msgstr "Verfügbarkeiten"
#: models.py:12 models.py:98 models.py:118 models.py:136 models.py:150
#: models.py:167 models.py:2
26
#: models.py:167 models.py:2
30
msgid "Name"
msgstr "Name"
...
...
@@ -355,71 +367,71 @@ msgstr "Erwartete Personenzahl"
msgid "AKs"
msgstr "AKs"
#: models.py:2
26
#: models.py:2
30
msgid "Name or number of the room"
msgstr "Name oder Nummer des Raums"
#: models.py:2
27
#: models.py:2
31
msgid "Building"
msgstr "Gebäude"
#: models.py:22
8
#: models.py:2
3
2
msgid "Name or number of the building"
msgstr "Name oder Nummer des Gebäudes"
#: models.py:2
29
#: models.py:2
33
msgid "Capacity"
msgstr "Kapazität"
#: models.py:2
29
#: models.py:2
33
msgid "Maximum number of people"
msgstr "Maximale Personenzahl"
#: models.py:23
0
#: models.py:23
4
msgid "Properties"
msgstr "Eigenschaften"
#: models.py:23
1
#: models.py:23
5
msgid "AK requirements fulfilled by the room"
msgstr "AK Anforderungen, die dieser Raum erfüllt"
#: models.py:2
38
#: models.py:2
42
msgid "Rooms"
msgstr "Räume"
#: models.py:25
1
#: models.py:25
5
msgid "AK being mapped"
msgstr "AK, der zugeordnet wird"
#: models.py:25
3
#: models.py:25
7
msgid "Room the AK will take place in"
msgstr "Raum in dem der AK stattfindet"
#: models.py:25
4
#: models.py:25
8
msgid "Slot Begin"
msgstr "Beginn des Slots"
#: models.py:25
4
#: models.py:25
8
msgid "Time and date the slot begins"
msgstr "Zeit und Datum zu der der AK beginnt"
#: models.py:2
5
6
#: models.py:26
0
msgid "Duration"
msgstr "Dauer"
#: models.py:2
57
#: models.py:2
61
msgid "Length in hours"
msgstr "Länge in Stunden"
#: models.py:26
3
#: models.py:26
7
msgid "AK Slot"
msgstr "AK Slot"
#: models.py:26
4
#: models.py:26
8
msgid "AK Slots"
msgstr "AK Slot"
#: models.py:2
7
8
#: models.py:28
2
msgid "Not scheduled yet"
msgstr "Noch nicht geplant"
...
...
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