diff gpp/shoutbox/views.py @ 118:a20b2c492d55

Reduced some sql queries by adding a select_related and monkey patching user profiles onto a user list in shoutbox and the bio/member's list, respectively.
author Brian Neal <bgneal@gmail.com>
date Sat, 24 Oct 2009 02:39:19 +0000
parents 62eb9cbbcffc
children e1d1a70d312d
line wrap: on
line diff
--- a/gpp/shoutbox/views.py	Fri Oct 23 03:09:33 2009 +0000
+++ b/gpp/shoutbox/views.py	Sat Oct 24 02:39:19 2009 +0000
@@ -52,7 +52,8 @@
 
 def view_history(request, page=1):
     """This view allows one to view the shoutbox history."""
-    paginator = DiggPaginator(Shout.objects.all(), SHOUTS_PER_PAGE, body=5, tail=3, margin=3, padding=2)
+    paginator = DiggPaginator(Shout.objects.all().select_related(), 
+            SHOUTS_PER_PAGE, body=5, tail=3, margin=3, padding=2)
     try:
         the_page = paginator.page(int(page))
     except InvalidPage: