Apply some low-hanging query count reduction

This commit is contained in:
Stefan Wehrmeyer 2022-03-16 19:00:44 +01:00
parent ff866fa052
commit 564f041b4a
3 changed files with 11 additions and 7 deletions

View file

@ -27,7 +27,9 @@ class GovPlanSectionDetailView(GovernmentMixin, DetailView):
template_name = "froide_govplan/section.html"
def get_queryset(self):
return GovernmentPlanSection.objects.filter(government=self.government)
return GovernmentPlanSection.objects.filter(
government=self.government
).select_related("government")
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)