Skip to content

Commit

Permalink
Clean up from cherry-pick/rebase
Browse files Browse the repository at this point in the history
Removed a redeclared variable and reformatted.

Issue #3296
  • Loading branch information
bickelj authored and frjo committed Oct 9, 2024
1 parent 7629ec7 commit 604e286
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
{% block title %}{% trans "Withdrawing" %}: {{object.title }}{% endblock %}

{% block content %}
<div class="admin-bar">
<div class="admin-bar__inner">
<h2 class="heading heading--no-margin">{% trans "Withdrawing" %}: {{ object.title }}</h2>
<div class="admin-bar">
<div class="admin-bar__inner">
<h2 class="heading heading--no-margin">{% trans "Withdrawing" %}: {{ object.title }}</h2>
</div>
</div>
</div>

<div class="wrapper wrapper--light-grey-bg wrapper--form wrapper--sidebar">
<div class="wrapper--sidebar--inner">
<form class="form" action="" method="post">
{% csrf_token %}
<p><strong>{% blocktrans %}Are you sure you want to withdraw "{{ object }}" from consideration?{% endblocktrans %}</strong></p>
<button class="button button--warning button--submit button--top-space" type="submit">{% trans "Confirm" %}</button>
</form>
<div class="wrapper wrapper--light-grey-bg wrapper--form wrapper--sidebar">
<div class="wrapper--sidebar--inner">
<form class="form" action="" method="post">
{% csrf_token %}
<p><strong>{% blocktrans %}Are you sure you want to withdraw "{{ object }}" from consideration?{% endblocktrans %}</strong></p>
<button class="button button--warning button--submit button--top-space" type="submit">{% trans "Confirm" %}</button>
</form>
</div>
</div>
</div>

{% endblock %}
4 changes: 3 additions & 1 deletion hypha/apply/funds/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,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/<uuid:field_id>/<str:file_name>",
SubmissionPrivateMediaView.as_view(),
Expand Down
17 changes: 10 additions & 7 deletions hypha/apply/funds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1734,10 +1734,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)
Expand All @@ -1751,20 +1752,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
Expand Down
6 changes: 4 additions & 2 deletions hypha/apply/funds/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]


Expand Down Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion hypha/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 604e286

Please sign in to comment.