Author: brosner
Date: Thu Oct  9 23:20:30 2008
New Revision: 1029

Modified:
    trunk/apps/local_apps/blog/views.py

Log:
Reduced the number of queries the blogs view generates by using  
select_related. Ideally we use some caching to get much better performance  
here.

Modified: trunk/apps/local_apps/blog/views.py
==============================================================================
--- trunk/apps/local_apps/blog/views.py (original)
+++ trunk/apps/local_apps/blog/views.py Thu Oct  9 23:20:30 2008
@@ -24,7 +24,7 @@
      friends = False

  def blogs(request, username=None, template_name="blog/blogs.html"):
-    blogs = Post.objects.filter(status=2).order_by("-publish")
+    blogs =  
Post.objects.filter(status=2).select_related(depth=1).order_by("-publish")
      if username is not None:
          user = get_object_or_404(User, username=username.lower())
          blogs = blogs.filter(author=user)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to