From 37e172711524c79c7c577026f13f7506d7c6d885 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Fri, 25 Jan 2019 16:57:24 +0000
Subject: [PATCH] Add in a way to filter out determined applications

---
 opentech/apply/funds/api_views.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/opentech/apply/funds/api_views.py b/opentech/apply/funds/api_views.py
index 92e286f5f..9e71379c5 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):
-- 
GitLab