diff --git a/hypha/apply/funds/models/submissions.py b/hypha/apply/funds/models/submissions.py index 3fdaab7efaed02213640a250bb8198d483d2f794..f13ae29f76522ca729a8f6f55bbe325f366f61d1 100644 --- a/hypha/apply/funds/models/submissions.py +++ b/hypha/apply/funds/models/submissions.py @@ -45,7 +45,7 @@ from ..blocks import NAMED_BLOCKS, ApplicationCustomFormFieldsBlock from ..workflow import ( COMMUNITY_REVIEW_PHASES, DETERMINATION_RESPONSE_PHASES, - DRAFT, + DRAFT_STATE, INITIAL_STATE, PHASES, PHASES_MAPPING, @@ -162,7 +162,7 @@ class ApplicationSubmissionQueryset(JSONOrderable): ) def exclude_draft(self): - return self.exclude(status=DRAFT) + return self.exclude(status=DRAFT_STATE) def with_latest_update(self): activities = self.model.activities.rel.model @@ -790,7 +790,7 @@ def log_status_update(sender, **kwargs): notify = kwargs['method_kwargs'].get('notify', True) if request and notify: - if kwargs['source'] == DRAFT: + if kwargs['source'] == DRAFT_STATE: messenger( MESSAGES.NEW_SUBMISSION, request=request, diff --git a/hypha/apply/funds/models/utils.py b/hypha/apply/funds/models/utils.py index b3f7500d442dddc41ed40d8043cdb85ee2f9990b..f1816417870485be6cea21316feee989e55247ff 100644 --- a/hypha/apply/funds/models/utils.py +++ b/hypha/apply/funds/models/utils.py @@ -18,7 +18,7 @@ from hypha.apply.users.groups import ( STAFF_GROUP_NAME, ) -from ..workflow import DRAFT, WORKFLOWS +from ..workflow import DRAFT_STATE, WORKFLOWS REVIEW_GROUPS = [ STAFF_GROUP_NAME, @@ -73,7 +73,7 @@ class SubmittableStreamForm(AbstractStreamForm): form_data=form.cleaned_data, form_fields=self.get_defined_fields(), **self.get_submit_meta_data(user=form.user), - status='draft', + status=DRAFT_STATE, ) else: return self.get_submission_class().objects.create( @@ -103,7 +103,7 @@ class WorkflowStreamForm(WorkflowHelpers, AbstractStreamForm): # type: ignore def render_landing_page(self, request, form_submission=None, *args, **kwargs): # We only reach this page after creation of a new submission # Hook in to notify about new applications - if not form_submission.status == DRAFT: + if not form_submission.status == DRAFT_STATE: messenger( MESSAGES.NEW_SUBMISSION, request=request, diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 75546936b433e9861f186aa851e53c9abffd350c..6d0ff830401dbc45688eb2f5745651279f3193be 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -90,7 +90,7 @@ from .tables import ( SummarySubmissionsTable, ) from .workflow import ( - DRAFT, + DRAFT_STATE, INITIAL_STATE, PHASES_MAPPING, STAGE_CHANGE_ACTIONS, @@ -697,7 +697,7 @@ class AdminSubmissionDetailView(ReviewContextMixin, ActivityContextMixin, Delega def dispatch(self, request, *args, **kwargs): submission = self.get_object() - if submission.status == DRAFT: + if submission.status == DRAFT_STATE: raise Http404 redirect = SubmissionSealedView.should_redirect(request, submission) return redirect or super().dispatch(request, *args, **kwargs) @@ -723,7 +723,7 @@ class ReviewerSubmissionDetailView(ReviewContextMixin, ActivityContextMixin, Del def dispatch(self, request, *args, **kwargs): submission = self.get_object() - if submission.status == DRAFT: + if submission.status == DRAFT_STATE: raise Http404 # If the requesting user submitted the application, return the Applicant view. # Reviewers may sometimes be applicants as well. @@ -737,7 +737,7 @@ class PartnerSubmissionDetailView(ActivityContextMixin, DelegateableView, Detail form_views = [CommentFormView] def get_object(self): - if submission.status == DRAFT: + if submission.status == DRAFT_STATE: raise Http404 return super().get_object().from_draft() @@ -761,7 +761,7 @@ class CommunitySubmissionDetailView(ReviewContextMixin, ActivityContextMixin, De def dispatch(self, request, *args, **kwargs): submission = self.get_object() - if submission.status == DRAFT: + if submission.status == DRAFT_STATE: raise Http404 # If the requesting user submitted the application, return the Applicant view. # Reviewers may sometimes be applicants as well. diff --git a/hypha/apply/funds/workflow.py b/hypha/apply/funds/workflow.py index 12216ba9d4e030ae26d42998a07d63590e79db6c..849485f0bd33767da09ef49e584fa94073dc2290 100644 --- a/hypha/apply/funds/workflow.py +++ b/hypha/apply/funds/workflow.py @@ -190,13 +190,13 @@ Concept = Stage('Concept', False) Proposal = Stage('Proposal', True) -DRAFT = 'draft' +DRAFT_STATE = 'draft' INITIAL_STATE = 'in_discussion' SingleStageDefinition = [ { - DRAFT: { + DRAFT_STATE: { 'transitions': { INITIAL_STATE: { 'display': 'Submit', @@ -309,7 +309,7 @@ SingleStageDefinition = [ SingleStageExternalDefinition = [ { - DRAFT: { + DRAFT_STATE: { 'transitions': { INITIAL_STATE: { 'display': 'Submit', @@ -453,7 +453,7 @@ SingleStageExternalDefinition = [ SingleStageCommunityDefinition = [ { - DRAFT: { + DRAFT_STATE: { 'transitions': { INITIAL_STATE: { 'display': 'Submit', @@ -621,7 +621,7 @@ SingleStageCommunityDefinition = [ DoubleStageDefinition = [ { - DRAFT: { + DRAFT_STATE: { 'transitions': { INITIAL_STATE: { 'display': 'Submit',