templates: fix OU link in role pages breadcrumb (#54201)

This commit is contained in:
Valentin Deniaud 2021-05-26 15:53:06 +02:00
parent 0f848ec694
commit 332f3c9575
2 changed files with 7 additions and 3 deletions

View File

@ -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'

View File

@ -6,8 +6,7 @@
{% block breadcrumb %}
{{ block.super }}
<a href="{% url 'a2-manager-roles' %}">{% trans 'Roles' %}</a>
{% firstof ou object.ou as current_ou %}
{% if multiple_ou and current_ou %}
<a href="{% url 'a2-manager-roles' %}?search-ou={{ current_ou.id }}">{{ current_ou }}</a>
{% if multiple_ou and ou %}
<a href="{% url 'a2-manager-roles' %}?search-ou={{ ou.pk }}">{{ ou }}</a>
{% endif %}
{% endblock %}