From ecd4bc97bc0f58e5251ddb3cffdfdfa61e0e4c00 Mon Sep 17 00:00:00 2001 From: James Polley Date: Sun, 17 Sep 2017 12:49:28 +1000 Subject: [PATCH] Expand bulk_accept to generic bulk_update Allows for bulk rejection/undecided/standby in addition to bulk accept. --- ...view_bulk_accept.html => review_bulk_update.html} | 0 vendor/symposion/reviews/forms.py | 12 +++++++++++- vendor/symposion/reviews/urls.py | 5 +++-- vendor/symposion/reviews/views.py | 8 +++++--- 4 files changed, 19 insertions(+), 6 deletions(-) rename pinaxcon/templates/symposion/reviews/{review_bulk_accept.html => review_bulk_update.html} (100%) diff --git a/pinaxcon/templates/symposion/reviews/review_bulk_accept.html b/pinaxcon/templates/symposion/reviews/review_bulk_update.html similarity index 100% rename from pinaxcon/templates/symposion/reviews/review_bulk_accept.html rename to pinaxcon/templates/symposion/reviews/review_bulk_update.html diff --git a/vendor/symposion/reviews/forms.py b/vendor/symposion/reviews/forms.py index f60ba2b7..865c615d 100644 --- a/vendor/symposion/reviews/forms.py +++ b/vendor/symposion/reviews/forms.py @@ -58,8 +58,18 @@ class BulkPresentationForm(forms.Form): required_css_class = 'label-required' + status = forms.ChoiceField( + choices=( + ('accepted', 'accepted'), + ('rejected', 'rejected'), + ('undecided', 'undecided'), + ('standby', 'standby') + ), + label="Set status to:", + help_text="Status to apply to the listed talk ids" + ) talk_ids = forms.CharField( label=_("Talk ids"), max_length=500, - help_text=_("Provide a comma seperated list of talk ids to accept.") + help_text=_("Provide a comma seperated list of talk ids to update.") ) diff --git a/vendor/symposion/reviews/urls.py b/vendor/symposion/reviews/urls.py index 6f8e9c43..e3437756 100644 --- a/vendor/symposion/reviews/urls.py +++ b/vendor/symposion/reviews/urls.py @@ -5,7 +5,7 @@ from .views import ( review_status, review_list, review_admin, - review_bulk_accept, + review_bulk_update, result_notification, result_notification_prepare, result_notification_send, @@ -27,7 +27,8 @@ urlpatterns = [ url(r"^section/(?P[\w\-]+)/status/(?P\w+)/$", review_status, name="review_status"), url(r"^section/(?P[\w\-]+)/list_reviewer/(?P\d+)/$", review_list, name="review_list_user"), url(r"^section/(?P[\w\-]+)/admin/$", review_admin, name="review_admin"), - url(r"^section/(?P[\w\-]+)/admin/accept/$", review_bulk_accept, name="review_bulk_accept"), + url(r"^section/(?P[\w\-]+)/admin/accept/$", review_bulk_update, name="review_bulk_accept"), + url(r"^section/(?P[\w\-]+)/admin/update/$", review_bulk_update, name="review_bulk_update"), url(r"^section/(?P[\w\-]+)/notification/(?P\w+)/$", result_notification, name="result_notification"), url(r"^section/(?P[\w\-]+)/notification/(?P\w+)/prepare/$", result_notification_prepare, name="result_notification_prepare"), url(r"^section/(?P[\w\-]+)/notification/(?P\w+)/send/$", result_notification_send, name="result_notification_send"), diff --git a/vendor/symposion/reviews/views.py b/vendor/symposion/reviews/views.py index fe8e2ba9..6efff504 100644 --- a/vendor/symposion/reviews/views.py +++ b/vendor/symposion/reviews/views.py @@ -529,22 +529,24 @@ def review_assignment_opt_out(request, pk): @login_required -def review_bulk_accept(request, section_slug): +@transaction.atomic +def review_bulk_update(request, section_slug): if not request.user.has_perm("reviews.can_manage_%s" % section_slug): return access_not_permitted(request) if request.method == "POST": form = BulkPresentationForm(request.POST) if form.is_valid(): talk_ids = form.cleaned_data["talk_ids"].split(",") + status = form.cleaned_data["status"] or "accepted" talks = ProposalBase.objects.filter(id__in=talk_ids).select_related("result") for talk in talks: - talk.result.status = "accepted" + talk.result.status = status talk.result.save() return redirect("review_section", section_slug=section_slug) else: form = BulkPresentationForm() - return render(request, "symposion/reviews/review_bulk_accept.html", { + return render(request, "symposion/reviews/review_bulk_update.html", { "form": form, })