summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-07-03 03:34:59 +0200
committerDan McGee <dan@archlinux.org>2010-07-03 03:37:06 +0200
commit41a5d1d5667dd2fe7cde64323f18252e0b94542e (patch)
tree4a6effc5631ac33b6a90114ef039c336b5f24694
parent357e8fa050b7ebc9cbfaff369b5f6c97c4b7001d (diff)
downloadarchweb-41a5d1d5667dd2fe7cde64323f18252e0b94542e.tar.gz
archweb-41a5d1d5667dd2fe7cde64323f18252e0b94542e.tar.xz
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>
-rw-r--r--news/views.py3
1 files changed, 2 insertions, 1 deletions
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")