optimize database queries with prefetch_related

This commit is contained in:
Élie Bouttier 2017-08-01 14:31:18 +02:00
parent c8dd061481
commit 459cfd6f0f
1 changed files with 1 additions and 0 deletions

View File

@ -194,6 +194,7 @@ def talk_list(request, conference):
glyphicon = 'sort'
sort_urls[c] = url.urlencode()
sort_glyphicons[c] = glyphicon
talks = talks.prefetch_related('speakers')
return render(request, 'cfp/staff/talk_list.html', {
'show_filters': show_filters,
'talk_list': talks,