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:
parent
357e8fa050
commit
41a5d1d566
@ -14,7 +14,8 @@ def view(request, newsid):
|
|||||||
|
|
||||||
#TODO: May as well use a date-based list here sometime
|
#TODO: May as well use a date-based list here sometime
|
||||||
def list(request):
|
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_name="news/list.html",
|
||||||
template_object_name="news")
|
template_object_name="news")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user