diff --git a/hypha/apply/funds/templates/funds/applicationsubmission_confirm_withdraw.html b/hypha/apply/funds/templates/funds/applicationsubmission_confirm_withdraw.html index d0830b01b6..396081fdbe 100644 --- a/hypha/apply/funds/templates/funds/applicationsubmission_confirm_withdraw.html +++ b/hypha/apply/funds/templates/funds/applicationsubmission_confirm_withdraw.html @@ -4,20 +4,20 @@ {% block title %}{% trans "Withdrawing" %}: {{object.title }}{% endblock %} {% block content %} -
-
-

{% trans "Withdrawing" %}: {{ object.title }}

+
+
+

{% trans "Withdrawing" %}: {{ object.title }}

+
-
-
-
-
- {% csrf_token %} -

{% blocktrans %}Are you sure you want to withdraw "{{ object }}" from consideration?{% endblocktrans %}

- -
+
+
+
+ {% csrf_token %} +

{% blocktrans %}Are you sure you want to withdraw "{{ object }}" from consideration?{% endblocktrans %}

+ +
+
-
{% endblock %} diff --git a/hypha/apply/funds/urls.py b/hypha/apply/funds/urls.py index a2d64412f0..0d64b4dbbb 100644 --- a/hypha/apply/funds/urls.py +++ b/hypha/apply/funds/urls.py @@ -253,7 +253,9 @@ "download/", SubmissionDetailPDFView.as_view(), name="download" ), path("delete/", SubmissionDeleteView.as_view(), name="delete"), - path('withdraw/', SubmissionWithdrawView.as_view(), name="withdraw"), + path( + "withdraw/", SubmissionWithdrawView.as_view(), name="withdraw" + ), path( "documents//", SubmissionPrivateMediaView.as_view(), diff --git a/hypha/apply/funds/views.py b/hypha/apply/funds/views.py index 1ba94d2765..68d67e5989 100644 --- a/hypha/apply/funds/views.py +++ b/hypha/apply/funds/views.py @@ -1737,10 +1737,11 @@ def form_valid(self, form): # delete submission and redirect to success url return super().form_valid(form) + class SubmissionWithdrawView(SingleObjectTemplateResponseMixin, BaseDetailView): model = ApplicationSubmission - success_url = reverse_lazy('funds:submissions:list') - template_name_suffix = '_confirm_withdraw' + success_url = reverse_lazy("funds:submissions:list") + template_name_suffix = "_confirm_withdraw" def post(self, request, *args, **kwargs): return self.withdraw(request, *args, **kwargs) @@ -1754,20 +1755,22 @@ def withdraw(self, request, *args, **kwargs): obj = self.get_object() - withdraw_actions = [action for action in obj.workflow[obj.status].transitions.keys() if 'withdraw' in action] + withdraw_actions = [ + action + for action in obj.workflow[obj.status].transitions.keys() + if "withdraw" in action + ] if len(withdraw_actions) > 0: action = withdraw_actions[0] obj.perform_transition( - action, - self.request.user, - request=self.request, - notify=False + action, self.request.user, request=self.request, notify=False ) success_url = obj.get_absolute_url() return HttpResponseRedirect(success_url) + @method_decorator(login_required, name="dispatch") class SubmissionPrivateMediaView(UserPassesTestMixin, PrivateMediaView): raise_exception = True diff --git a/hypha/apply/funds/workflow.py b/hypha/apply/funds/workflow.py index 906b6beaa2..a3056c89a8 100644 --- a/hypha/apply/funds/workflow.py +++ b/hypha/apply/funds/workflow.py @@ -1212,7 +1212,10 @@ def get_stage_change_actions(): active_statuses = [ status for status, _ in PHASES - if "accepted" not in status and "rejected" not in status and "invited" not in status and "withdrawn" not in status + if "accepted" not in status + and "rejected" not in status + and "invited" not in status + and "withdrawn" not in status ] @@ -1294,7 +1297,6 @@ def get_withdrawn_statuses(): return withdrawn_statuses -ext_or_higher_statuses = get_ext_or_higher_statuses() review_statuses = get_review_statuses() ext_review_statuses = get_ext_review_statuses() ext_or_higher_statuses = get_ext_or_higher_statuses() diff --git a/hypha/settings/base.py b/hypha/settings/base.py index 37eb7e3a5d..407c67851d 100644 --- a/hypha/settings/base.py +++ b/hypha/settings/base.py @@ -162,7 +162,7 @@ SUBMISSION_PREVIEW_REQUIRED = env.bool("SUBMISSION_PREVIEW_REQUIRED", True) # Allow Withdrawing of Submissions -ENABLE_SUBMISSION_WITHDRAWAL = env.bool('ENABLE_SUBMISSION_WITHDRAWAL', False) +ENABLE_SUBMISSION_WITHDRAWAL = env.bool("ENABLE_SUBMISSION_WITHDRAWAL", False) # Project settings.