Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
ots
hypha
Commits
86038302
Commit
86038302
authored
5 years ago
by
Fredrik Jonsson
Browse files
Options
Downloads
Patches
Plain Diff
Add a open/closed filter to the round admin page in wagtail admin.
parent
f076b017
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
opentech/apply/funds/admin.py
+2
-0
2 additions, 0 deletions
opentech/apply/funds/admin.py
opentech/apply/funds/admin_helpers.py
+19
-0
19 additions, 0 deletions
opentech/apply/funds/admin_helpers.py
with
21 additions
and
0 deletions
opentech/apply/funds/admin.py
+
2
−
0
View file @
86038302
...
...
@@ -12,6 +12,7 @@ from opentech.apply.categories.admin import CategoryAdmin, MetaTermAdmin
from
.admin_helpers
import
(
ButtonsWithPreview
,
FormsFundRoundListFilter
,
RoundStateListFilter
,
RoundFundChooserView
,
ApplicationFormButtonHelper
,
)
...
...
@@ -32,6 +33,7 @@ class RoundAdmin(BaseRoundAdmin):
model
=
Round
menu_icon
=
'
repeat
'
list_display
=
(
'
title
'
,
'
fund
'
,
'
start_date
'
,
'
end_date
'
,
'
applications
'
,
'
review_forms
'
)
list_filter
=
(
RoundStateListFilter
,)
def
applications
(
self
,
obj
):
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/funds/admin_helpers.py
+
19
−
0
View file @
86038302
...
...
@@ -71,6 +71,25 @@ class FormsFundRoundListFilter(admin.SimpleListFilter):
return
queryset
class
RoundStateListFilter
(
admin
.
SimpleListFilter
):
title
=
'
state
'
parameter_name
=
'
form-state
'
def
lookups
(
self
,
request
,
model_admin
):
return
(
(
'
open
'
,
_
(
'
Open
'
)),
(
'
closed
'
,
_
(
'
Closed
'
)),
)
def
queryset
(
self
,
request
,
queryset
):
value
=
self
.
value
()
if
value
==
'
open
'
:
return
queryset
.
open
()
elif
value
==
'
closed
'
:
return
queryset
.
closed
()
return
queryset
class
ApplicationFormButtonHelper
(
ButtonHelper
):
def
prepare_classnames
(
self
,
start
=
None
,
add
=
None
,
exclude
=
None
):
"""
Parse classname sets into final css classess list.
"""
...
...
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