Merge branch 'ticket-testing' into 'master'

Update bulk_update functionality

See merge request LCA2018/symposion_app!30
This commit is contained in:
James Polley 2017-09-17 03:43:37 +00:00
commit 6bf38337fd
8 changed files with 38 additions and 9 deletions

View file

@ -18,5 +18,5 @@ RUN set -ex \
&& apt-get install -y git xmlsec1 libmysqlclient18 \
&& apt-get install -y $buildDeps --no-install-recommends
RUN pip install -c /setup/constraints.txt -r /setup/requirements.txt
CMD ["python","/source/manage.py", "makemigrations"]
ENTRYPOINT ["python","/source/manage.py", "makemigrations"]

View file

@ -1,4 +1,4 @@
#!/bin/bash -x
docker image build -f docker/Dockerfile.makemigrations -t makemigrations .
docker run -it --env-file=docker/laptop-mode-env -v $(pwd):/source makemigrations
docker run -it --env-file=docker/laptop-mode-env -v $(pwd):/source makemigrations $*

View file

@ -42,7 +42,7 @@
<button id="next-button" type="submit" class="btn btn-primary" disabled>Next <i class="fa fa-chevron-right"></i></button>
</p>
<table class="table table-striped table-bordered">
<table class="table table-striped table-bordered table-reviews">
<thead>
<th><input type="checkbox" id="action-toggle"></th>
<th>#</th>

View file

@ -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.")
)

View file

@ -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<section_slug>[\w\-]+)/status/(?P<key>\w+)/$", review_status, name="review_status"),
url(r"^section/(?P<section_slug>[\w\-]+)/list_reviewer/(?P<user_pk>\d+)/$", review_list, name="review_list_user"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/$", review_admin, name="review_admin"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/accept/$", review_bulk_accept, name="review_bulk_accept"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/accept/$", review_bulk_update, name="review_bulk_accept"),
url(r"^section/(?P<section_slug>[\w\-]+)/admin/update/$", review_bulk_update, name="review_bulk_update"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/$", result_notification, name="result_notification"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/prepare/$", result_notification_prepare, name="result_notification_prepare"),
url(r"^section/(?P<section_slug>[\w\-]+)/notification/(?P<status>\w+)/send/$", result_notification_send, name="result_notification_send"),

View file

@ -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,
})

View file

@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-17 02:48
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('symposion_speakers', '0004_auto_20170702_2250'),
('symposion_speakers', '0004_auto_20170731_2232'),
]
operations = [
]