Skip to content

Commit

Permalink
[4.2.x] Fixed #34512 -- Restored breadcrumbs on admin app index view.
Browse files Browse the repository at this point in the history
Thanks Adam (ataylor32) for the report.

Regression in 872b611.
Backport of 9440f6b from main
  • Loading branch information
felixxm committed Apr 26, 2023
1 parent 9ab8067 commit fffbf85
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
18 changes: 10 additions & 8 deletions django/contrib/admin/templates/admin/app_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@
{% block bodyclass %}{{ block.super }} app-{{ app_label }}{% endblock %}

{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
{% for app in app_list %}
{{ app.name }}
{% endfor %}
</div>
{% block nav-breadcrumbs %}
<nav aria-label="{% translate 'Breadcrumbs' %}">
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% translate 'Home' %}</a>
&rsaquo;
{% for app in app_list %}
{{ app.name }}
{% endfor %}
</div>
</nav>
{% endblock %}
{% endif %}

Expand Down
3 changes: 3 additions & 0 deletions docs/releases/4.2.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ Bugfixes

* Fixed a regression in Django 4.2 that caused incorrect ``ClearableFileInput``
margins in the admin (:ticket:`34506`).

* Fixed a regression in Django 4.2 where breadcrumbs didn't appear on admin
site app index views (:ticket:`34512`).
4 changes: 4 additions & 0 deletions tests/admin_views/test_breadcrumbs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ def test_breadcrumbs_absent(self):
def test_breadcrumbs_present(self):
response = self.client.get(reverse("admin:auth_user_add"))
self.assertContains(response, '<nav aria-label="Breadcrumbs">')
response = self.client.get(
reverse("admin:app_list", kwargs={"app_label": "auth"})
)
self.assertContains(response, '<nav aria-label="Breadcrumbs">')

0 comments on commit fffbf85

Please sign in to comment.