diff --git a/opentech/apply/funds/models.py b/opentech/apply/funds/models.py index 8b43dbcf5c9169843c224794f10713b42d694ab4..e2e95fceb8f8b566baed144723b7355d70da5072 100644 --- a/opentech/apply/funds/models.py +++ b/opentech/apply/funds/models.py @@ -602,14 +602,28 @@ class ApplicationSubmission(WorkflowHelpers, BaseStreamForm, AbstractFormSubmiss def not_progressed(self): return not self.next + @property + def stage(self): + return self.phase.stage + + @property + def phase(self): + return self.workflow.get(self.status) + + @property + def active(self): + return self.status in active_statuses + @transition( status, source='*', target=RETURN_VALUE(INITIAL_STATE, 'draft_proposal', 'invited_to_proposal'), + conditions=[active], permission=make_permission_check({UserPermissions.ADMIN}), ) def restart_stage(self, **kwargs): """ If running form the console please include your user using the kwarg "by" + Will not reset applications which are accepted/rejected u = User.objects.get(email="<my@email.com>") for a in ApplicationSubmission.objects.all(): @@ -622,17 +636,6 @@ class ApplicationSubmission(WorkflowHelpers, BaseStreamForm, AbstractFormSubmiss return 'invited_to_proposal' return INITIAL_STATE - @property - def stage(self): - return self.phase.stage - - @property - def phase(self): - return self.workflow.get(self.status) - - @property - def active(self): - return self.status in active_statuses @property def last_edit(self):