mirror of
https://github.com/django/django.git
synced 2024-11-21 19:09:18 +01:00
Fixed #35876 -- Displayed non-ASCII fieldset names when rendering ModelAdmin.fieldsets.
Thank you to Namhong Kim for the report, and to Mariusz Felisiak and Marijke Luttekes for the review.
Regression in 01ed59f753
.
This commit is contained in:
parent
0eaaadd47f
commit
2c029c718f
@ -1,8 +1,7 @@
|
||||
{% with name=fieldset.name|default:""|slugify %}
|
||||
<fieldset class="module aligned {{ fieldset.classes }}"{% if name %} aria-labelledby="{{ prefix }}-{{ id_prefix}}-{{ name }}-{{ id_suffix }}-heading"{% endif %}>
|
||||
{% if name %}
|
||||
<fieldset class="module aligned {{ fieldset.classes }}"{% if fieldset.name %} aria-labelledby="{{ prefix }}-{{ id_prefix}}-{{ id_suffix }}-heading"{% endif %}>
|
||||
{% if fieldset.name %}
|
||||
{% if fieldset.is_collapsible %}<details><summary>{% endif %}
|
||||
<h{{ heading_level|default:2 }} id="{{ prefix }}-{{ id_prefix}}-{{ name }}-{{ id_suffix }}-heading" class="fieldset-heading">{{ fieldset.name }}</h{{ heading_level|default:2 }}>
|
||||
<h{{ heading_level|default:2 }} id="{{ prefix }}-{{ id_prefix}}-{{ id_suffix }}-heading" class="fieldset-heading">{{ fieldset.name }}</h{{ heading_level|default:2 }}>
|
||||
{% if fieldset.is_collapsible %}</summary>{% endif %}
|
||||
{% endif %}
|
||||
{% if fieldset.description %}
|
||||
@ -36,6 +35,5 @@
|
||||
{% if not line.fields|length == 1 %}</div>{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if name and fieldset.is_collapsible %}</details>{% endif %}
|
||||
{% if fieldset.name and fieldset.is_collapsible %}</details>{% endif %}
|
||||
</fieldset>
|
||||
{% endwith %}
|
||||
|
@ -17,3 +17,6 @@ Bugfixes
|
||||
|
||||
* Fixed a regression in Django 5.1 that prevented the use of DB-IP databases
|
||||
with :class:`~django.contrib.gis.geoip2.GeoIP2` (:ticket:`35841`).
|
||||
|
||||
* Fixed a regression in Django 5.1 where non-ASCII fieldset names were not
|
||||
displayed when rendering admin fieldsets (:ticket:`35876`).
|
||||
|
@ -1801,7 +1801,7 @@ class TestInlineWithFieldsets(TestDataMixin, TestCase):
|
||||
# The second and third have the same "Advanced options" name, but the
|
||||
# second one has the "collapse" class.
|
||||
for x, classes in ((1, ""), (2, "collapse")):
|
||||
heading_id = f"fieldset-0-advanced-options-{x}-heading"
|
||||
heading_id = f"fieldset-0-{x}-heading"
|
||||
with self.subTest(heading_id=heading_id):
|
||||
self.assertContains(
|
||||
response,
|
||||
@ -1846,7 +1846,7 @@ class TestInlineWithFieldsets(TestDataMixin, TestCase):
|
||||
# Every fieldset defined for an inline's form.
|
||||
for z, fieldset in enumerate(inline_admin_form):
|
||||
if fieldset.name:
|
||||
heading_id = f"{prefix}-{y}-details-{z}-heading"
|
||||
heading_id = f"{prefix}-{y}-{z}-heading"
|
||||
self.assertContains(
|
||||
response,
|
||||
f'<fieldset class="module aligned {fieldset.classes}" '
|
||||
|
@ -237,6 +237,7 @@ class ArticleAdmin(ArticleAdminWithExtraUrl):
|
||||
"Some other fields",
|
||||
{"classes": ("wide",), "fields": ("date", "section", "sub_section")},
|
||||
),
|
||||
("이름", {"fields": ("another_section",)}),
|
||||
)
|
||||
|
||||
# These orderings aren't particularly useful but show that expressions can
|
||||
|
@ -2533,6 +2533,19 @@ class AdminViewPermissionsTest(TestCase):
|
||||
self.assertContains(
|
||||
response, '<input type="submit" value="Save and view" name="_continue">'
|
||||
)
|
||||
self.assertContains(
|
||||
response,
|
||||
'<h2 id="fieldset-0-0-heading" class="fieldset-heading">Some fields</h2>',
|
||||
)
|
||||
self.assertContains(
|
||||
response,
|
||||
'<h2 id="fieldset-0-1-heading" class="fieldset-heading">'
|
||||
"Some other fields</h2>",
|
||||
)
|
||||
self.assertContains(
|
||||
response,
|
||||
'<h2 id="fieldset-0-2-heading" class="fieldset-heading">이름</h2>',
|
||||
)
|
||||
post = self.client.post(
|
||||
reverse("admin:admin_views_article_add"), add_dict, follow=False
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user