Skip to content
Snippets Groups Projects
Commit 0272dcef authored by Dan Braghis's avatar Dan Braghis
Browse files

Clean up the use of progress_stage

parent c98aa5a8
No related branches found
No related tags found
No related merge requests found
...@@ -83,12 +83,11 @@ class DeterminationCreateOrUpdateView(CreateOrUpdateView): ...@@ -83,12 +83,11 @@ class DeterminationCreateOrUpdateView(CreateOrUpdateView):
return self.progress_stage(self.submission) or response return self.progress_stage(self.submission) or response
def progress_stage(self, instance): def progress_stage(self, instance):
# TODO update post-revisions work try:
proposal_transition = instance.get_transition('draft_proposal') instance.perform_transition('draft_proposal', self.request.user)
if proposal_transition: except PermissionDenied:
if can_proceed(proposal_transition): pass
proposal_transition(by=self.request.user) else:
instance.save()
return HttpResponseRedirect(instance.get_absolute_url()) return HttpResponseRedirect(instance.get_absolute_url())
def get_action_name_from_determination(self, determination): def get_action_name_from_determination(self, determination):
......
...@@ -585,6 +585,8 @@ class AddTransitions(models.base.ModelBase): ...@@ -585,6 +585,8 @@ class AddTransitions(models.base.ModelBase):
def perform_transition(self, action, user): def perform_transition(self, action, user):
transition = self.get_transition(action) transition = self.get_transition(action)
if not transition:
raise PermissionDenied(f'Invalid "{ action }" transition')
if not can_proceed(transition): if not can_proceed(transition):
action = self.phase.transitions[action] action = self.phase.transitions[action]
raise PermissionDenied(f'You do not have permission to "{ action }"') raise PermissionDenied(f'You do not have permission to "{ action }"')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment