diff gpp/bio/models.py @ 223:cd4124b19196

For #51; add user profiles to Haystack search.
author Brian Neal <bgneal@gmail.com>
date Mon, 07 Jun 2010 03:37:36 +0000
parents 8c1832b9d815
children 75ea1a8be7f2
line wrap: on
line diff
--- a/gpp/bio/models.py	Sun Jun 06 21:05:48 2010 +0000
+++ b/gpp/bio/models.py	Mon Jun 07 03:37:36 2010 +0000
@@ -127,6 +127,16 @@
     user_is_active.boolean = True
     user_is_active.short_description = "Is Active"
 
+    def search_title(self):
+        full_name = self.user.get_full_name()
+        if full_name:
+            return u"%s (%s)" % (self.user.username, full_name)
+        return self.user.username
+
+    def search_summary(self):
+        return u"\n".join((self.location, self.occupation, self.interests,
+            self.profile_text, self.signature))
+
 
 class UserProfileFlag(models.Model):
     """This model represents a user flagging a profile as inappropriate."""