Defer loading news content when listing news items

No need to pull back some 500 news articles when we just want the basics of
title, date, and author. Speaking of author, we might as well load that at
the same time too.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2010-07-02 20:34:59 -05:00
parent 357e8fa050
commit 41a5d1d566

View File

@ -14,7 +14,8 @@ def view(request, newsid):
#TODO: May as well use a date-based list here sometime
def list(request):
return list_detail.object_list(request, News.objects.all(),
return list_detail.object_list(request,
News.objects.all().select_related('author').defer('content'),
template_name="news/list.html",
template_object_name="news")