diff gpp/forums/models.py @ 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 b1f939b1fb01
children e9f203c5f5bb
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''