changeset 426:c8148cf11a79

Show number of posts in a topic when displaying forum topic search results. Fixing #212.
author Brian Neal <bgneal@gmail.com>
date Tue, 26 Apr 2011 01:04:38 +0000
parents 76ba9478ebbd
children 85d7b62d5c17
files gpp/forums/models.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/forums/models.py	Tue Apr 26 00:16:35 2011 +0000
+++ b/gpp/forums/models.py	Tue Apr 26 01:04:38 2011 +0000
@@ -260,7 +260,12 @@
             self.last_post = None
 
     def search_title(self):
-        return u"%s by %s" % (self.name, self.user.username)
+        if self.post_count == 1:
+            post_text = "(1 post)"
+        else:
+            post_text = "(%d posts)" % self.post_count
+
+        return u"%s by %s; %s" % (self.name, self.user.username, post_text)
 
     def search_summary(self):
         return u''