Fix latest topic listings

This commit is contained in:
Trever Fischer
2012-04-17 13:14:09 -04:00
parent 820c904d39
commit d1c93cd675
3 changed files with 6 additions and 8 deletions

View File

@@ -42,11 +42,9 @@ class Forum(MPTTModel):
def topicCount(self):
return self.topic_set.count()
def latestTopic(self):
try:
return self.topic_set.extra(order_by = ['created'])[0]
except IndexError, e:
return None
def freshestTopic(self):
freshestForum = self.get_descendants(True).extra(order_by = ['-topic__updated'])[0]
return freshestForum.topic_set.extra(order_by = ['-updated'])[0]
@models.permalink
def get_absolute_url(self):