diff gpp/downloads/views.py @ 190:0e4961833cdf

Added some select_related's to downloads.
author Brian Neal <bgneal@gmail.com>
date Thu, 01 Apr 2010 01:57:01 +0000
parents 62eb9cbbcffc
children b4305e18d3af
line wrap: on
line diff
--- a/gpp/downloads/views.py	Thu Apr 01 01:39:37 2010 +0000
+++ b/gpp/downloads/views.py	Thu Apr 01 01:57:01 2010 +0000
@@ -64,7 +64,8 @@
         sort = 'title'
     order_by = DOWNLOAD_FIELD_MAP[sort]
 
-    downloads = Download.public_objects.filter(category=cat.pk).order_by(order_by)
+    downloads = Download.public_objects.filter(category=cat.pk).order_by(
+            order_by)
     paginator = create_paginator(downloads)
     try:
         the_page = paginator.page(int(page))
@@ -202,7 +203,8 @@
 
     dls = Download.objects.filter(
             Q(title__icontains = query_text) |
-            Q(description__icontains = query_text)).order_by('title')
+            Q(description__icontains = query_text)).order_by(
+                    'title').select_related()
     paginator = create_paginator(dls)
     try:
         the_page = paginator.page(int(page))