From 82d815bc17071a3adf67b82a16be341f33322065 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Thu, 24 Jan 2019 09:32:05 +0000
Subject: [PATCH] Pass in the filter target for the submissions table

---
 .../apply/funds/templates/funds/base_submissions_table.html    | 3 +--
 .../templates/funds/includes/table_filter_and_search.html      | 2 +-
 opentech/apply/funds/views.py                                  | 3 +++
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/opentech/apply/funds/templates/funds/base_submissions_table.html b/opentech/apply/funds/templates/funds/base_submissions_table.html
index 41e9256ea..d9214f80d 100644
--- a/opentech/apply/funds/templates/funds/base_submissions_table.html
+++ b/opentech/apply/funds/templates/funds/base_submissions_table.html
@@ -8,8 +8,7 @@
 
 {% block content %}
     {% block table %}
-
-        {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True%}
+        {% include "funds/includes/table_filter_and_search.html" with filter_form=filter_form search_term=search_term use_search=True filter_action=filter_action %}
 
         {% render_table table %}
     {% endblock %}
diff --git a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html
index 3f75c4437..e4cff0f2d 100644
--- a/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html
+++ b/opentech/apply/funds/templates/funds/includes/table_filter_and_search.html
@@ -18,7 +18,7 @@
         <button class="filters__button js-close-filters">Close</button>
     </div>
 
-    <form action="" method="get" class="form form--filters js-filter-form">
+    <form action="{{ filter_action }}" method="get" class="form form--filters js-filter-form">
         <ul class="form__filters select2">
             {{ filter.form.as_ul }}
             <li>
diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py
index df9c8a1eb..84ca43380 100644
--- a/opentech/apply/funds/views.py
+++ b/opentech/apply/funds/views.py
@@ -46,6 +46,7 @@ from .workflow import STAGE_CHANGE_ACTIONS
 class BaseAdminSubmissionsTable(SingleTableMixin, FilterView):
     table_class = AdminSubmissionsTable
     filterset_class = SubmissionFilterAndSearch
+    filter_action = ''
 
     excluded_fields = []
 
@@ -72,6 +73,7 @@ class BaseAdminSubmissionsTable(SingleTableMixin, FilterView):
         search_term = self.request.GET.get('query')
         kwargs.update(
             search_term=search_term,
+            filter_action=self.filter_action,
         )
 
         return super().get_context_data(**kwargs)
@@ -81,6 +83,7 @@ class SubmissionListView(AllActivityContextMixin, BaseAdminSubmissionsTable):
     template_name = 'funds/submissions.html'
     table_class = SummarySubmissionsTable
     table_pagination = False
+    filter_action = reverse_lazy('funds:submissions:list')
 
     def get_queryset(self):
         return super().get_queryset()[:5]
-- 
GitLab