From 24234cb350459df733ec165447880a4c71239aa6 Mon Sep 17 00:00:00 2001
From: Dan Braghis <dan.braghis@torchbox.com>
Date: Tue, 19 Jun 2018 13:49:13 +0100
Subject: [PATCH] Fix determination re-submit allowed for non-more_info

---
 opentech/apply/determinations/models.py | 3 +++
 opentech/apply/determinations/views.py  | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/opentech/apply/determinations/models.py b/opentech/apply/determinations/models.py
index 0d7cb5d16..101c05f60 100644
--- a/opentech/apply/determinations/models.py
+++ b/opentech/apply/determinations/models.py
@@ -43,6 +43,9 @@ class Determination(models.Model):
     def get_absolute_url(self):
         return reverse('apply:submissions:determinations:detail', args=(self.id,))
 
+    def submitted(self):
+        return self.determination != UNDETERMINED and not self.is_draft
+
     def __str__(self):
         return f'Determination for {self.submission.title} by {self.author!s}'
 
diff --git a/opentech/apply/determinations/views.py b/opentech/apply/determinations/views.py
index f904017d7..540345085 100644
--- a/opentech/apply/determinations/views.py
+++ b/opentech/apply/determinations/views.py
@@ -54,6 +54,14 @@ class DeterminationCreateOrUpdateView(CreateOrUpdateView):
                 and not self.submission.user_lead_or_admin(request.user):
             raise PermissionDenied()
 
+        try:
+            submitted = self.get_object().submitted
+        except Determination.DoesNotExist:
+            submitted = False
+
+        if self.request.POST and submitted:
+            return self.get(request, *args, **kwargs)
+
         return super().dispatch(request, *args, **kwargs)
 
     def get_context_data(self, **kwargs):
-- 
GitLab