summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRick Ross <rick@dzone.com>2009-12-28 23:27:09 -0500
committerRick Ross <rick@dzone.com>2009-12-28 23:27:09 -0500
commit2f4bfbd5c5d61ed6ba1e1f956c04a74207c94939 (patch)
treef893da4129b2b7546493004d63699ed06d0e9a50
parent82d35490db90878f013523c4d1a5ec3af2df8b23 (diff)
downloadaskbot-2f4bfbd5c5d61ed6ba1e1f956c04a74207c94939.tar.gz
askbot-2f4bfbd5c5d61ed6ba1e1f956c04a74207c94939.tar.bz2
askbot-2f4bfbd5c5d61ed6ba1e1f956c04a74207c94939.zip
Handled a case where votes is null for unauthenticated user
-rw-r--r--forum/models.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/forum/models.py b/forum/models.py
index bceced1a..c3b89ce9 100644
--- a/forum/models.py
+++ b/forum/models.py
@@ -482,7 +482,7 @@ class Answer(models.Model):
def get_user_vote(self, user):
votes = self.votes.filter(user=user)
- if votes.count() > 0:
+ if votes and votes.count() > 0:
return votes[0]
else:
return None