diff --git a/opentech/apply/funds/api_views.py b/opentech/apply/funds/api_views.py index 92e286f5f3207cb49e00927e3c112449171d3c68..9e71379c54e5ae0b2d56b9233120a8723fdb90b1 100644 --- a/opentech/apply/funds/api_views.py +++ b/opentech/apply/funds/api_views.py @@ -37,10 +37,20 @@ class SubmissionsFilter(filters.FilterSet): # TODO replace with better call to Round and Lab base class round = RoundLabFilter(queryset=Page.objects.type(SubmittableStreamForm)) status = filters.MultipleChoiceFilter(choices=PHASES) + active = filters.BooleanFilter(method='filter_active') class Meta: model = ApplicationSubmission - fields = ('status', 'round') + fields = ('status', 'round', 'active') + + def filter_active(self, value): + if value is None: + return qs + + if value: + return qs.active() + else: + return qs.inactive() class SubmissionList(generics.ListAPIView):