diff gpp/messages/models.py @ 425:76ba9478ebbd

Initial beta-test commit of a revamped, jquery ui tab-based PM system. This is for #211.
author Brian Neal <bgneal@gmail.com>
date Tue, 26 Apr 2011 00:16:35 +0000
parents 272d3a8c98e8
children d0f0800eef0c
line wrap: on
line diff
--- a/gpp/messages/models.py	Sun Apr 24 03:54:40 2011 +0000
+++ b/gpp/messages/models.py	Tue Apr 26 00:16:35 2011 +0000
@@ -14,17 +14,17 @@
 
     def inbox(self, user):
         return self.filter(receiver=user,
-            receiver_delete_date__isnull=True)
+            receiver_delete_date__isnull=True).select_related('sender')
 
     def outbox(self, user):
         return self.filter(sender=user,
-            sender_delete_date__isnull=True)
+            sender_delete_date__isnull=True).select_related('receiver')
 
     def trash(self, user):
         return self.filter(
             Q(sender=user, sender_delete_date__isnull=False) |
             Q(receiver=user, receiver_delete_date__isnull=False)
-        )
+        ).select_related()
 
     def unread_count(self, user):
         return self.filter(receiver=user, read_date__isnull=True).count()