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('
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('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('You cannot vote for your own submission.
') - r.status = 400 - return r + return HttpResponse('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()