[Django] #35876: In the fieldset.html template for Django admin, using the slugify function within the with block causes the fieldset name to not display correctly when it contains Korean characters.

22 views
Skip to first unread message

Django

unread,
Oct 29, 2024, 10:33:06 PM10/29/24
to django-...@googlegroups.com
#35876: In the fieldset.html template for Django admin, using the slugify function
within the with block causes the fieldset name to not display correctly
when it contains Korean characters.
-----------------------------+-----------------------------------------
Reporter: Namhong Kim | Type: Bug
Status: new | Component: contrib.admin
Version: 5.1 | Severity: Normal
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+-----------------------------------------
In Django ModelAdmin, when defining fieldsets with Korean characters or
using gettext_lazy, the fieldset names do not display correctly. This
issue occurs because the slugify filter has allow_unicode set to False,
which removes all non-ASCII characters.

{{{
class BlogAdmin(admin.ModelAdmin):
fieldsets = [
("이름", {"fields": ["name"]}),
]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35876>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Oct 30, 2024, 3:55:21 AM10/30/24
to django-...@googlegroups.com
#35876: In the fieldset.html template for Django admin, using the slugify function
within the with block causes the fieldset name to not display correctly
when it contains Korean characters.
---------------------------------+------------------------------------
Reporter: Namhong Kim | Owner: (none)
Type: Bug | Status: new
Component: contrib.admin | Version: 5.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by Sarah Boyce):

* cc: Marijke Luttekes (added)
* severity: Normal => Release blocker
* stage: Unreviewed => Accepted

Comment:

Replicated thank you! Regression in
01ed59f753139afb514170ee7f7384c155ecbc2d

Possible regression test:
{{{#!diff
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index 0ea64d594a..5e14069bae 100644
--- a/tests/admin_views/admin.py
+++ b/tests/admin_views/admin.py
@@ -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
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index 17174ff5e0..db6cc1c86f 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -2533,6 +2533,9 @@ class AdminViewPermissionsTest(TestCase):
self.assertContains(
response, '<input type="submit" value="Save and view"
name="_continue">'
)
+ self.assertContains(response, "Some fields")
+ self.assertContains(response, "Some other fields")
+ self.assertContains(response, "이름")
post = self.client.post(
reverse("admin:admin_views_article_add"), add_dict,
follow=False
)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35876#comment:1>

Django

unread,
Oct 30, 2024, 4:31:10 AM10/30/24
to django-...@googlegroups.com
#35876: In the fieldset.html template for Django admin, using the slugify function
within the with block causes the fieldset name to not display correctly
when it contains Korean characters.
---------------------------------+---------------------------------------
Reporter: Namhong Kim | Owner: Sarah Boyce
Type: Bug | Status: assigned
Component: contrib.admin | Version: 5.1
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+---------------------------------------
Changes (by Sarah Boyce):

* has_patch: 0 => 1
* owner: (none) => Sarah Boyce
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/35876#comment:2>
Reply all
Reply to author
Forward
0 new messages