Commit e76819c5 authored by fred's avatar fred
Browse files

performance: get categories along the emissions

This cuts down the /emissions/ view from 247 to 16 queries.
parent c2a29acb
......@@ -396,7 +396,7 @@ class Emissions(TemplateView):
def get_context_data(self, **kwargs):
context = super(Emissions, self).get_context_data(**kwargs)
context['sectionName'] = "Emissions"
context['emissions'] = Emission.objects.all().filter(archived=False).order_by('title')
context['emissions'] = Emission.objects.prefetch_related('categories').filter(archived=False).order_by('title')
context['categories'] = Category.objects.all()
return context
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