class Emissions(TemplateView):
template_name = 'emissions.html'
+ def get_queryset(self):
+ return Emission.objects.prefetch_related('categories').filter(archived=False).order_by('title')
+
def get_context_data(self, **kwargs):
context = super(Emissions, self).get_context_data(**kwargs)
- context['emissions'] = (
- Emission.objects.prefetch_related('categories').filter(archived=False).order_by('title')
- )
+ context['emissions'] = self.get_queryset()
context['categories'] = Category.objects.all()
return context