# HG changeset patch # User Brian Neal # Date 1270087021 0 # Node ID 0e4961833cdf73156d3d232dad72dc1c42bc25f8 # Parent db202792d9f5e4e059d497545eb3a847fd8c0e29 Added some select_related's to downloads. diff -r db202792d9f5 -r 0e4961833cdf gpp/downloads/models.py --- a/gpp/downloads/models.py Thu Apr 01 01:39:37 2010 +0000 +++ b/gpp/downloads/models.py Thu Apr 01 01:57:01 2010 +0000 @@ -43,7 +43,8 @@ class PublicDownloadManager(models.Manager): """The manager for all public downloads.""" def get_query_set(self): - return super(PublicDownloadManager, self).get_query_set().filter(is_public=True) + return super(PublicDownloadManager, self).get_query_set().filter( + is_public=True).select_related() class Download(models.Model): diff -r db202792d9f5 -r 0e4961833cdf gpp/downloads/views.py --- 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))