From ee3a0f357a82642d909df28e42e230f662bb8907 Mon Sep 17 00:00:00 2001 From: Jorran de Wit <jorrandewit@outlook.com> Date: Fri, 15 Sep 2017 19:21:31 +0200 Subject: [PATCH] Ease debugging --- submissions/views.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/submissions/views.py b/submissions/views.py index 7f5345134..b1418fecc 100644 --- a/submissions/views.py +++ b/submissions/views.py @@ -1067,6 +1067,16 @@ def eic_recommendation(request, arxiv_identifier_w_vn_nr): return redirect(reverse('submissions:editorial_page', args=[submission.arxiv_identifier_w_vn_nr])) + # Find EditorialAssignment for user + try: + assignment = submission.editorial_assignments.get(submission=submission, + to=request.user.contributor) + except EditorialAssignment.DoesNotExist: + messages.warning(request, ('You cannot formulate an Editorial Recommendation,' + ' because you are not assigned as editor-in-charge.')) + return redirect(reverse('submissions:editorial_page', + args=[submission.arxiv_identifier_w_vn_nr])) + form = EICRecommendationForm(request.POST or None) if form.is_valid(): # Create new EICRecommendation @@ -1103,8 +1113,6 @@ def eic_recommendation(request, arxiv_identifier_w_vn_nr): submission.save() # The EIC has fulfilled this editorial assignment. - assignment = get_object_or_404(EditorialAssignment, - submission=submission, to=request.user.contributor) assignment.completed = True assignment.save() messages.success(request, 'Your Editorial Recommendation has been succesfully submitted') -- GitLab