mirror of
https://github.com/django/django.git
synced 2024-12-22 17:16:24 +00:00
Fixed #34835 -- Made admin's changelist filters render in <nav> tag.
This commit is contained in:
parent
2128a73713
commit
357365a64e
1
AUTHORS
1
AUTHORS
@ -589,6 +589,7 @@ answer newbie questions, and generally made Django that much better:
|
|||||||
Leandra Finger <leandra.finger@gmail.com>
|
Leandra Finger <leandra.finger@gmail.com>
|
||||||
Lee Reilly <lee@leereilly.net>
|
Lee Reilly <lee@leereilly.net>
|
||||||
Lee Sanghyuck <shlee322@elab.kr>
|
Lee Sanghyuck <shlee322@elab.kr>
|
||||||
|
Lemuel Sta Ana <https://github.com/lstaana>
|
||||||
Leo "hylje" Honkanen <sealage@gmail.com>
|
Leo "hylje" Honkanen <sealage@gmail.com>
|
||||||
Leo Shklovskii
|
Leo Shklovskii
|
||||||
Leo Soto <leo.soto@gmail.com>
|
Leo Soto <leo.soto@gmail.com>
|
||||||
|
@ -73,8 +73,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{% block filters %}
|
{% block filters %}
|
||||||
{% if cl.has_filters %}
|
{% if cl.has_filters %}
|
||||||
<div id="changelist-filter">
|
<nav id="changelist-filter" aria-labelledby="changelist-filter-header">
|
||||||
<h2>{% translate 'Filter' %}</h2>
|
<h2 id="changelist-filter-header">{% translate 'Filter' %}</h2>
|
||||||
{% if cl.is_facets_optional or cl.has_active_filters %}<div id="changelist-filter-extra-actions">
|
{% if cl.is_facets_optional or cl.has_active_filters %}<div id="changelist-filter-extra-actions">
|
||||||
{% if cl.is_facets_optional %}<h3>
|
{% if cl.is_facets_optional %}<h3>
|
||||||
{% if cl.add_facets %}<a href="{{ cl.remove_facet_link }}" class="hidelink">{% translate "Hide counts" %}</a>
|
{% if cl.add_facets %}<a href="{{ cl.remove_facet_link }}" class="hidelink">{% translate "Hide counts" %}</a>
|
||||||
@ -85,7 +85,7 @@
|
|||||||
</h3>{% endif %}
|
</h3>{% endif %}
|
||||||
</div>{% endif %}
|
</div>{% endif %}
|
||||||
{% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
|
{% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}
|
||||||
</div>
|
</nav>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -248,7 +248,8 @@ PostgreSQL 13 and higher.
|
|||||||
Miscellaneous
|
Miscellaneous
|
||||||
-------------
|
-------------
|
||||||
|
|
||||||
* ...
|
* In order to improve accessibility, the admin's changelist filter is now
|
||||||
|
rendered in a ``<nav>`` tag instead of a ``<div>``.
|
||||||
|
|
||||||
.. _deprecated-features-5.1:
|
.. _deprecated-features-5.1:
|
||||||
|
|
||||||
|
@ -812,7 +812,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
|
|||||||
response = self.client.get(reverse("admin:admin_views_thing_changelist"))
|
response = self.client.get(reverse("admin:admin_views_thing_changelist"))
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
'<div id="changelist-filter">',
|
'<nav id="changelist-filter" aria-labelledby="changelist-filter-header">',
|
||||||
msg_prefix="Expected filter not found in changelist view",
|
msg_prefix="Expected filter not found in changelist view",
|
||||||
)
|
)
|
||||||
self.assertNotContains(
|
self.assertNotContains(
|
||||||
@ -865,7 +865,10 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
|
|||||||
def test_relation_spanning_filters(self):
|
def test_relation_spanning_filters(self):
|
||||||
changelist_url = reverse("admin:admin_views_chapterxtra1_changelist")
|
changelist_url = reverse("admin:admin_views_chapterxtra1_changelist")
|
||||||
response = self.client.get(changelist_url)
|
response = self.client.get(changelist_url)
|
||||||
self.assertContains(response, '<div id="changelist-filter">')
|
self.assertContains(
|
||||||
|
response,
|
||||||
|
'<nav id="changelist-filter" aria-labelledby="changelist-filter-header">',
|
||||||
|
)
|
||||||
filters = {
|
filters = {
|
||||||
"chap__id__exact": {
|
"chap__id__exact": {
|
||||||
"values": [c.id for c in Chapter.objects.all()],
|
"values": [c.id for c in Chapter.objects.all()],
|
||||||
@ -1002,7 +1005,10 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
|
|||||||
"Changelist filter isn't showing options contained inside a model "
|
"Changelist filter isn't showing options contained inside a model "
|
||||||
"field 'choices' option named group."
|
"field 'choices' option named group."
|
||||||
)
|
)
|
||||||
self.assertContains(response, '<div id="changelist-filter">')
|
self.assertContains(
|
||||||
|
response,
|
||||||
|
'<nav id="changelist-filter" aria-labelledby="changelist-filter-header">',
|
||||||
|
)
|
||||||
self.assertContains(
|
self.assertContains(
|
||||||
response,
|
response,
|
||||||
'<a href="?surface__exact=x">Horizontal</a>',
|
'<a href="?surface__exact=x">Horizontal</a>',
|
||||||
|
Loading…
Reference in New Issue
Block a user