conserve lines, fix issue
This commit is contained in:
parent
c3eff9f88a
commit
1f71c26fe7
@ -88,10 +88,8 @@ class SubmissionVoteSubmit(View):
|
||||
pos_bool = int(positive) == 1
|
||||
|
||||
# Check for login status
|
||||
if not req.session['user_id']:
|
||||
r = HttpResponse('<h1>Error</h1><p>You need to be logged in to vote. Please <a href=/login>log in</a></p>')
|
||||
r.status = 400
|
||||
return r
|
||||
if not 'user_id' in req.session:
|
||||
return HttpResponse('<h1>Error</h1><p>You need to be logged in to vote. Please <a href=/login>log in</a></p>', 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('<h1>Error</h1><p>You cannot vote for your own submission.</p>')
|
||||
r.status = 400
|
||||
return r
|
||||
return HttpResponse('<h1>Error</h1><p>You cannot vote for your own submission.</p>', 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()
|
||||
|
Reference in New Issue
Block a user