From 84c28750d3d3a9cd6a6eb823842eed39a1f073ef Mon Sep 17 00:00:00 2001 From: Valentin Deniaud Date: Wed, 26 May 2021 15:53:06 +0200 Subject: [PATCH] templates: fix OU link in role pages breadcrumb (#54201) --- src/authentic2/manager/role_views.py | 5 +++++ .../manager/templates/authentic2/manager/role_common.html | 5 ++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/authentic2/manager/role_views.py b/src/authentic2/manager/role_views.py index bf65fc49..5595d60b 100644 --- a/src/authentic2/manager/role_views.py +++ b/src/authentic2/manager/role_views.py @@ -144,6 +144,11 @@ export = RolesExportView.as_view() class RoleViewMixin(RolesMixin): model = get_role_model() + def get_context_data(self, **kwargs): + ctx = super().get_context_data(**kwargs) + ctx['ou'] = self.get_object().ou + return ctx + class RoleEditView(RoleViewMixin, views.BaseEditView): template_name = 'authentic2/manager/role_edit.html' diff --git a/src/authentic2/manager/templates/authentic2/manager/role_common.html b/src/authentic2/manager/templates/authentic2/manager/role_common.html index 3167b9d0..7fb36c65 100644 --- a/src/authentic2/manager/templates/authentic2/manager/role_common.html +++ b/src/authentic2/manager/templates/authentic2/manager/role_common.html @@ -6,8 +6,7 @@ {% block breadcrumb %} {{ block.super }} {% trans 'Roles' %} - {% firstof ou object.ou as current_ou %} - {% if multiple_ou and current_ou %} - {{ current_ou }} + {% if multiple_ou and ou %} + {{ ou }} {% endif %} {% endblock %} -- 2.20.1