From cedac7935f10258230b4e5de7eb63dd098b87c3b Mon Sep 17 00:00:00 2001 From: Adolfo Fitoria Date: Sat, 8 Aug 2009 22:54:56 -0600 Subject: fixing a bug in question view --- forum/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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] -- cgit v1.2.3-1-g7c22