diff --git a/opentech/apply/determinations/models.py b/opentech/apply/determinations/models.py index 0d7cb5d1649e7ea2d03592efd1776edc4d72dbef..101c05f6031021ecbfcb80dd5057f0c66453be8a 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 f904017d769a3924ff7ceff2356c14721faa6e88..5403450859cd81de7cabf9eceec13d96ffbcb6bd 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):