From 1f71c26fe780f93079a93e0beca6aff9bc6b9d9e Mon Sep 17 00:00:00 2001 From: Evert Date: Sat, 11 Nov 2017 12:41:41 +0200 Subject: [PATCH] conserve lines, fix issue --- Show/views.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/Show/views.py b/Show/views.py index d8a5afb..e6e7a02 100644 --- a/Show/views.py +++ b/Show/views.py @@ -88,10 +88,8 @@ class SubmissionVoteSubmit(View): pos_bool = int(positive) == 1 # Check for login status - if not req.session['user_id']: - r = HttpResponse('

Error

You need to be logged in to vote. Please log in

') - r.status = 400 - return r + if not 'user_id' in req.session: + return HttpResponse('

Error

You need to be logged in to vote. Please log in

', status=400) user = User.objects.get(user_id=req.session['user_id']) @@ -104,9 +102,7 @@ class SubmissionVoteSubmit(View): # Prevent voting for own submission if submission.user == user: - r = HttpResponse('

Error

You cannot vote for your own submission.

') - r.status = 400 - return r + return HttpResponse('

Error

You cannot vote for your own submission.

', status=400) # Allow changing a vote from positive to negative or vice-versa. Delete vote if its a re-vote vote = submission.votes.filter(user=user,submission__id=submission.id).first()