From 7f955c29e097ee8c35b1c9a560b2fbef6175c325 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Tue, 13 Mar 2018 17:25:29 +0000
Subject: [PATCH] Add submission into the context

---
 opentech/apply/funds/urls.py                            | 2 +-
 opentech/apply/review/templates/review/review_form.html | 1 +
 opentech/apply/review/views.py                          | 7 +++++++
 3 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/opentech/apply/funds/urls.py b/opentech/apply/funds/urls.py
index 60f0b74a1..d3eecc66b 100644
--- a/opentech/apply/funds/urls.py
+++ b/opentech/apply/funds/urls.py
@@ -10,6 +10,6 @@ urlpatterns = [
     path('submissions/', SubmissionListView.as_view(), name="submissions"),
     path('submissions/<int:pk>/', SubmissionDetailView.as_view(), name="submission"),
     path('submissions/<int:pk>/edit', SubmissionEditView.as_view(), name="edit_submission"),
-    path('submissions/<int:pk>/review/', include('opentech.apply.review.urls')),
+    path('submissions/<int:submission_pk>/review/', include('opentech.apply.review.urls')),
     path('search', SubmissionSearchView.as_view(), name="search"),
 ]
diff --git a/opentech/apply/review/templates/review/review_form.html b/opentech/apply/review/templates/review/review_form.html
index e4e2ef9d7..19e0a24bd 100644
--- a/opentech/apply/review/templates/review/review_form.html
+++ b/opentech/apply/review/templates/review/review_form.html
@@ -4,6 +4,7 @@
 <div class="wrapper wrapper--breakout wrapper--admin">
     <div class="wrapper wrapper--medium">
         <h2 class="heading heading--no-margin">Create Review</h2>
+        <h5>For: {{ submission.title }}</h5>
     </div>
 </div>
 
diff --git a/opentech/apply/review/views.py b/opentech/apply/review/views.py
index 28b82c65a..fe72183b9 100644
--- a/opentech/apply/review/views.py
+++ b/opentech/apply/review/views.py
@@ -8,3 +8,10 @@ from .models import Review
 class CreateReviewView(CreateView):
     model = Review
     fields = ['review']
+
+    def get_context_data(self, **kwargs):
+        submission = get_object_or_404(ApplicationSubmission, id=self.kwargs['submission_pk'])
+        return super().get_context_data(
+            submission=submission,
+            **kwargs,
+        )
-- 
GitLab