Commit 69d3feb7 authored by fred's avatar fred

performance: prefetch categories in listen page (190 -> 12 SQL queries)

parent 8c292fda
......@@ -482,7 +482,7 @@ class Listen(TemplateView):
def get_context_data(self, **kwargs):
context = super(Listen, self).get_context_data(**kwargs)
context['sectionName'] = "Listen"
context['episodes'] = Episode.objects.filter(
context['episodes'] = Episode.objects.prefetch_related('emission__categories').filter(
soundfile__podcastable=True, soundfile__fragment=False) \
.select_related().extra(select={
'first_diffusion': 'emissions_diffusion.datetime', },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment