implemented more result notification behavior
This commit is contained in:
		
							parent
							
								
									6186a913df
								
							
						
					
					
						commit
						df0ea0655c
					
				
					 2 changed files with 21 additions and 1 deletions
				
			
		|  | @ -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\-]+)/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"^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"), |     url(r"^review/(?P<pk>\d+)/$", "review_detail", name="review_detail"), | ||||||
|      |      | ||||||
|  |  | ||||||
|  | @ -414,6 +414,7 @@ def result_notification_prepare(request, section_slug, status): | ||||||
|         "section_slug": section_slug, |         "section_slug": section_slug, | ||||||
|         "status": status, |         "status": status, | ||||||
|         "proposals": proposals, |         "proposals": proposals, | ||||||
|  |         "proposal_pks": " ".join(proposal_pks), | ||||||
|     } |     } | ||||||
|     return render(request, "reviews/result_notification_prepare.html", ctx) |     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": |     if request.method != "POST": | ||||||
|         return HttpResponseNotAllowed(["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) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Brian Rosner
						Brian Rosner