Commit d15e75ff authored by 段英荣's avatar 段英荣

modify

parent d627a6e9
...@@ -85,9 +85,11 @@ class Topic(models.Model): ...@@ -85,9 +85,11 @@ class Topic(models.Model):
def get_virtual_vote_num(self): def get_virtual_vote_num(self):
try: try:
topic_extra = TopicExtra.object.get(topic_id=self.id) topic_extra = TopicExtra.objects.filter(topic_id=self.id).first()
return topic_extra.virtual_vote_num virtual_vote_num = topic_extra.virtual_vote_num if topic_extra else 0
return virtual_vote_num
except: except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return 0 return 0
def get_pictorial_id(self): def get_pictorial_id(self):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment