Skip to content
Snippets Groups Projects
Commit 12756831 authored by Parbhat Puri's avatar Parbhat Puri
Browse files

By default set open filter for Round listing page's index URL

parent 86038302
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ from .admin_helpers import ( ...@@ -14,6 +14,7 @@ from .admin_helpers import (
FormsFundRoundListFilter, FormsFundRoundListFilter,
RoundStateListFilter, RoundStateListFilter,
RoundFundChooserView, RoundFundChooserView,
RoundAdminURLHelper,
ApplicationFormButtonHelper, ApplicationFormButtonHelper,
) )
from .admin_views import CopyApplicationFormViewClass from .admin_views import CopyApplicationFormViewClass
...@@ -34,6 +35,7 @@ class RoundAdmin(BaseRoundAdmin): ...@@ -34,6 +35,7 @@ class RoundAdmin(BaseRoundAdmin):
menu_icon = 'repeat' menu_icon = 'repeat'
list_display = ('title', 'fund', 'start_date', 'end_date', 'applications', 'review_forms') list_display = ('title', 'fund', 'start_date', 'end_date', 'applications', 'review_forms')
list_filter = (RoundStateListFilter,) list_filter = (RoundStateListFilter,)
url_helper_class = RoundAdminURLHelper
def applications(self, obj): def applications(self, obj):
......
from urllib.parse import urlencode
from django import forms from django import forms
from django.contrib import admin from django.contrib import admin
from django.urls import reverse from django.urls import reverse
from django.utils.functional import cached_property
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from wagtail.contrib.modeladmin.forms import ParentChooserForm from wagtail.contrib.modeladmin.forms import ParentChooserForm
from wagtail.contrib.modeladmin.helpers import PageButtonHelper, ButtonHelper from wagtail.contrib.modeladmin.helpers import PageAdminURLHelper, PageButtonHelper, ButtonHelper
from wagtail.contrib.modeladmin.views import ChooseParentView from wagtail.contrib.modeladmin.views import ChooseParentView
from wagtail.core.models import Page from wagtail.core.models import Page
...@@ -122,3 +125,11 @@ class ApplicationFormButtonHelper(ButtonHelper): ...@@ -122,3 +125,11 @@ class ApplicationFormButtonHelper(ButtonHelper):
buttons.append(copy_form_button) buttons.append(copy_form_button)
return buttons return buttons
class RoundAdminURLHelper(PageAdminURLHelper):
@cached_property
def index_url(self):
# By default set open filter for Round listing page's index URL
params = {'form-state': 'open'}
return f"{self.get_action_url('index')}?{urlencode(params)}"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment