implemented more result notification behavior

This commit is contained in:
Brian Rosner 2012-09-08 16:29:17 -06:00
parent 6186a913df
commit df0ea0655c
2 changed files with 21 additions and 1 deletions

View file

@ -11,6 +11,7 @@ urlpatterns = patterns("symposion.reviews.views",
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+)/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"),
url(r"^review/(?P<pk>\d+)/$", "review_detail", name="review_detail"),

View file

@ -414,6 +414,7 @@ def result_notification_prepare(request, section_slug, status):
"section_slug": section_slug,
"status": status,
"proposals": proposals,
"proposal_pks": " ".join(proposal_pks),
}
return render(request, "reviews/result_notification_prepare.html", ctx)
@ -422,4 +423,22 @@ def result_notification_send(request, section_slug, status):
if request.method != "POST":
return HttpResponseNotAllowed(["POST"])
# @@@ discuss with jtauber about how to handle this
if "proposal_pks" not in request.POST:
return HttpResponseBadRequest()
try:
proposal_pks = [int(pk) for pk in request.POST["proposal_pks"]]
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()
# create ResultNotification objects and send
return redirect("result_notification", section_slug=section_slug, status=status)