🐛 handle plan details without section

This commit is contained in:
krmax44 2024-02-26 12:04:08 +01:00 committed by Max
parent f72e87f404
commit 27f39f6a1f

View file

@ -81,8 +81,13 @@ class GovPlanDetailView(GovernmentMixin, DetailView):
def get_breadcrumbs(self, context):
obj = context["object"]
section = context["section"]
return super().get_breadcrumbs(context) + [
(section.title, section.get_absolute_url()),
breadcrumbs = super().get_breadcrumbs(context)
if section:
breadcrumbs.append((section.title, section.get_absolute_url()))
return breadcrumbs + [
(obj.title, obj.get_absolute_url()),
]