added result_notification_prepare view and stubbed out result_notification_send

This commit is contained in:
Brian Rosner 2012-09-07 18:11:43 -06:00
parent 3c2a0de89d
commit 5fefff0a3d
3 changed files with 83 additions and 38 deletions

View file

@ -10,6 +10,7 @@ urlpatterns = patterns("symposion.reviews.views",
url(r"^section/(?P<section_slug>[\w\-]+)/admin/$", "review_admin", name="review_admin"), 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_accept", name="review_bulk_accept"),
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+)/$", "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"^review/(?P<pk>\d+)/$", "review_detail", name="review_detail"), url(r"^review/(?P<pk>\d+)/$", "review_detail", name="review_detail"),

View file

@ -1,4 +1,5 @@
from django.db.models import Q from django.db.models import Q
from django.http import HttpResponseBadRequest, HttpResponseNotAllowed
from django.shortcuts import render, redirect, get_object_or_404 from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.http import require_POST from django.views.decorators.http import require_POST
@ -380,6 +381,41 @@ def result_notification(request, section_slug, status):
ctx = { ctx = {
"section_slug": section_slug, "section_slug": section_slug,
"status": status,
"proposals": proposals, "proposals": proposals,
} }
return render(request, "reviews/result_notification.html", ctx) return render(request, "reviews/result_notification.html", ctx)
@login_required
def result_notification_prepare(request, section_slug, status):
if request.method != "POST":
return HttpResponseNotAllowed(["POST"])
proposal_pks = []
try:
for pk in request.POST.getlist("_selected_action"):
proposal_pks.append(int(pk))
except ValueError:
return HttpResponseBadRequest()
proposals = ProposalBase.objects.filter(
kind__section__slug=section_slug,
result__status=status,
)
proposals = proposals.filter(pk__in=proposal_pks)
proposals = proposals.select_related("speaker__user", "result")
proposals = proposals.select_subclasses()
ctx = {
"section_slug": section_slug,
"status": status,
"proposals": proposals,
}
return render(request, "reviews/result_notification_prepare.html", ctx)
def result_notification_send(request, section_slug, status):
if request.method != "POST":
return HttpResponseNotAllowed(["POST"])
# @@@ discuss with jtauber about how to handle this

View file

@ -15,6 +15,10 @@
<span class="action-counter">0</span> selected <span class="action-counter">0</span> selected
<form method="post" action="{% url result_notification_prepare section_slug status %}">
{% csrf_token %}
<table class="table table-striped table-bordered"> <table class="table table-striped table-bordered">
<thead> <thead>
<th><input type="checkbox" id="action-toggle"></th> <th><input type="checkbox" id="action-toggle"></th>
@ -53,6 +57,10 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<button type="submit" class="btn btn-primary">POST IT</button>
</form>
{% endblock %} {% endblock %}
{% block extra_script %} {% block extra_script %}