From 41a5d1d5667dd2fe7cde64323f18252e0b94542e Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Fri, 2 Jul 2010 20:34:59 -0500 Subject: 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 --- news/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'news') diff --git a/news/views.py b/news/views.py index 2fe3743..0b7b379 100644 --- a/news/views.py +++ b/news/views.py @@ -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") -- cgit v1.2.3-24-g4f1b