Skip to content
Snippets Groups Projects
Commit aa695eeb authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add filter for funds

parent 14e2b3e8
No related branches found
No related tags found
No related merge requests found
import django_filters as filters import django_filters as filters
import django_tables2 as tables import django_tables2 as tables
from wagtail.wagtailcore.models import Page
from opentech.apply.funds.models import ApplicationSubmission, Round from opentech.apply.funds.models import ApplicationSubmission, Round
...@@ -23,9 +25,15 @@ def get_used_rounds(request): ...@@ -23,9 +25,15 @@ def get_used_rounds(request):
return Round.objects.filter(submissions__isnull=False).distinct() return Round.objects.filter(submissions__isnull=False).distinct()
def get_used_funds(request):
# Use page to pick up on both Labs and Funds
return Page.objects.filter(applicationsubmission__isnull=False).distinct()
class SubmissionFilter(filters.FilterSet): class SubmissionFilter(filters.FilterSet):
round = filters.ModelMultipleChoiceFilter(queryset=get_used_rounds) round = filters.ModelMultipleChoiceFilter(queryset=get_used_rounds)
page = filters.ModelMultipleChoiceFilter(queryset=get_used_funds, label='Funds')
class Meta: class Meta:
model = ApplicationSubmission model = ApplicationSubmission
fields = ('round',) fields = ('page', 'round',)
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