Mercurial > public > sg101
changeset 191:046e6ef0ff45
Added select_related() to weblinks.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Thu, 01 Apr 2010 02:01:33 +0000 |
parents | 0e4961833cdf |
children | 341759e1cda1 |
files | gpp/weblinks/models.py gpp/weblinks/views.py |
diffstat | 2 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gpp/weblinks/models.py Thu Apr 01 01:57:01 2010 +0000 +++ b/gpp/weblinks/models.py Thu Apr 01 02:01:33 2010 +0000 @@ -25,7 +25,8 @@ class PublicLinkManager(models.Manager): """The manager for all public links.""" def get_query_set(self): - return super(PublicLinkManager, self).get_query_set().filter(is_public=True) + return super(PublicLinkManager, self).get_query_set().filter( + is_public=True).select_related() class Link(models.Model):
--- a/gpp/weblinks/views.py Thu Apr 01 01:57:01 2010 +0000 +++ b/gpp/weblinks/views.py Thu Apr 01 02:01:33 2010 +0000 @@ -193,7 +193,7 @@ links = Link.public_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(links) try: the_page = paginator.page(int(page))