Add breadcrumb/section links

This commit is contained in:
Stefan Wehrmeyer 2022-03-14 19:16:52 +01:00
parent 635d73d18b
commit 14413d9437
5 changed files with 23 additions and 5 deletions

View file

@ -41,11 +41,17 @@ class GovPlanDetailView(GovernmentMixin, DetailView):
return qs
return qs.filter(public=True)
def get_section(self):
return GovernmentPlanSection.objects.filter(
categories__in=self.object.categories.all()
).first()
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["updates"] = self.object.updates.filter(public=True).order_by(
"-timestamp"
)
context["section"] = self.get_section()
return context