From aa695eeb944ab8af54c54a5d4553a5b84d9db9c5 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Thu, 15 Feb 2018 10:32:39 +0000
Subject: [PATCH] Add filter for funds

---
 opentech/apply/dashboard/tables.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/opentech/apply/dashboard/tables.py b/opentech/apply/dashboard/tables.py
index 74ad34a90..d51aa4b49 100644
--- a/opentech/apply/dashboard/tables.py
+++ b/opentech/apply/dashboard/tables.py
@@ -1,6 +1,8 @@
 import django_filters as filters
 import django_tables2 as tables
 
+from wagtail.wagtailcore.models import Page
+
 from opentech.apply.funds.models import ApplicationSubmission, Round
 
 
@@ -23,9 +25,15 @@ def get_used_rounds(request):
     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):
     round = filters.ModelMultipleChoiceFilter(queryset=get_used_rounds)
+    page = filters.ModelMultipleChoiceFilter(queryset=get_used_funds, label='Funds')
 
     class Meta:
         model = ApplicationSubmission
-        fields = ('round',)
+        fields = ('page', 'round',)
-- 
GitLab