diff options
-rw-r--r-- | forum/views.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/forum/views.py b/forum/views.py index 6ef7bd6d..1566e9a8 100644 --- a/forum/views.py +++ b/forum/views.py @@ -332,7 +332,10 @@ def question(request, id): answers = answers.select_related(depth=1) favorited = question.has_favorite_by_user(request.user) - question_vote = question.votes.select_related().filter(user=request.user) + if not request.user.is_anonymous(): + question_vote = question.votes.select_related().filter(user=request.user) + else: + question_vote = None #is this correct? if question_vote is not None and question_vote.count() > 0: question_vote = question_vote[0] |