From 64fc3aae38afc8ea1c5561f59140453e9ad6414f Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Tue, 13 Feb 2018 14:02:02 +0000
Subject: [PATCH] Move the submission views and urls into funds

---
 opentech/apply/dashboard/tables.py                          | 2 +-
 opentech/apply/dashboard/urls.py                            | 3 +--
 .../funds/templates/funds/applicationsubmission_detail.html | 1 +
 opentech/apply/funds/urls.py                                | 6 ++++--
 opentech/apply/funds/views.py                               | 6 ++++++
 opentech/apply/urls.py                                      | 2 +-
 6 files changed, 14 insertions(+), 6 deletions(-)
 create mode 100644 opentech/apply/funds/templates/funds/applicationsubmission_detail.html

diff --git a/opentech/apply/dashboard/tables.py b/opentech/apply/dashboard/tables.py
index 7c3c14269..8f9f80f86 100644
--- a/opentech/apply/dashboard/tables.py
+++ b/opentech/apply/dashboard/tables.py
@@ -10,7 +10,7 @@ from .widgets import Select2MultiCheckboxesWidget
 
 
 class DashboardTable(tables.Table):
-    title = tables.LinkColumn('dashboard:submission', args=[A('pk')], orderable=True)
+    title = tables.LinkColumn('funds:submission', args=[A('pk')], orderable=True)
     submit_time = tables.DateColumn(verbose_name="Submitted")
     status_name = tables.Column(verbose_name="Status")
     stage = tables.Column(verbose_name="Type")
diff --git a/opentech/apply/dashboard/urls.py b/opentech/apply/dashboard/urls.py
index a7d3221b3..26944a19f 100644
--- a/opentech/apply/dashboard/urls.py
+++ b/opentech/apply/dashboard/urls.py
@@ -1,9 +1,8 @@
 from django.conf.urls import url
 
-from .views import DashboardView, SubmissionDetailView
+from .views import DashboardView
 
 
 urlpatterns = [
     url(r'^$', DashboardView.as_view(), name="dashboard"),
-    url(r'^submission/(?P<pk>\d+)/$', SubmissionDetailView.as_view(), name="submission"),
 ]
diff --git a/opentech/apply/funds/templates/funds/applicationsubmission_detail.html b/opentech/apply/funds/templates/funds/applicationsubmission_detail.html
new file mode 100644
index 000000000..163773723
--- /dev/null
+++ b/opentech/apply/funds/templates/funds/applicationsubmission_detail.html
@@ -0,0 +1 @@
+{% extends "base-admin.html" %}
diff --git a/opentech/apply/funds/urls.py b/opentech/apply/funds/urls.py
index 9d1bd7796..8df134af8 100644
--- a/opentech/apply/funds/urls.py
+++ b/opentech/apply/funds/urls.py
@@ -1,7 +1,9 @@
 from django.conf.urls import url
 
-from .views import demo_workflow
+from .views import SubmissionDetailView, demo_workflow
+
 
 urlpatterns = [
-    url(r'^demo/(?P<wf_id>[1-2])/$', demo_workflow, name="workflow_demo")
+    url(r'^demo/(?P<wf_id>[1-2])/$', demo_workflow, name="workflow_demo"),
+    url(r'^submission/(?P<pk>\d+)/$', SubmissionDetailView.as_view(), name="submission"),
 ]
diff --git a/opentech/apply/funds/views.py b/opentech/apply/funds/views.py
index bb3b10454..8bf0719f8 100644
--- a/opentech/apply/funds/views.py
+++ b/opentech/apply/funds/views.py
@@ -1,9 +1,15 @@
 from django import forms
 from django.template.response import TemplateResponse
+from django.views.generic import DetailView
 
+from .models import ApplicationSubmission
 from .workflow import SingleStage, DoubleStage
 
 
+class SubmissionDetailView(DetailView):
+    model = ApplicationSubmission
+
+
 workflows = [SingleStage, DoubleStage]
 
 
diff --git a/opentech/apply/urls.py b/opentech/apply/urls.py
index 802e5c0fc..6a4d437d8 100644
--- a/opentech/apply/urls.py
+++ b/opentech/apply/urls.py
@@ -6,7 +6,7 @@ from .dashboard import urls as dashboard_urls
 
 
 urlpatterns = [
-    url(r'^apply/', include(funds_urls)),
+    url(r'^apply/', include(funds_urls, namespace='funds')),
     url(r'^account/', include(users_urls, namespace='users')),
     url(r'^dashboard/', include(dashboard_urls, namespace='dashboard')),
 ]
-- 
GitLab