Opened 7 weeks ago

Closed 7 weeks ago

Last modified 7 weeks ago

#35876 closed Bug (fixed)

Non-ASCII fieldset names are not displayed in the admin

Reported by: Namhong Kim Owned by: Sarah Boyce
Component: contrib.admin Version: 5.1
Severity: Release blocker Keywords:
Cc: Namhong Kim, Marijke Luttekes Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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"]}),
    ]

Change History (7)

comment:1 by Sarah Boyce, 7 weeks ago

Cc: Marijke Luttekes added
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

Replicated thank you! Regression in 01ed59f753139afb514170ee7f7384c155ecbc2d

Possible regression test:

  • tests/admin_views/admin.py

    diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
    index 0ea64d594a..5e14069bae 100644
    a b class ArticleAdmin(ArticleAdminWithExtraUrl):  
    237237            "Some other fields",
    238238            {"classes": ("wide",), "fields": ("date", "section", "sub_section")},
    239239        ),
     240        ("이름", {"fields": ("another_section",)}),
    240241    )
    241242
    242243    # These orderings aren't particularly useful but show that expressions can
  • tests/admin_views/tests.py

    diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
    index 17174ff5e0..db6cc1c86f 100644
    a b class AdminViewPermissionsTest(TestCase):  
    25332533        self.assertContains(
    25342534            response, '<input type="submit" value="Save and view" name="_continue">'
    25352535        )
     2536        self.assertContains(response, "Some fields")
     2537        self.assertContains(response, "Some other fields")
     2538        self.assertContains(response, "이름")
    25362539        post = self.client.post(
    25372540            reverse("admin:admin_views_article_add"), add_dict, follow=False
    25382541        )

comment:2 by Sarah Boyce, 7 weeks ago

Has patch: set
Owner: set to Sarah Boyce
Status: newassigned

comment:3 by Sarah Boyce, 7 weeks ago

Summary: 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.Non-ASCII fieldset names are not displayed in the admin

comment:4 by Sarah Boyce, 7 weeks ago

Triage Stage: AcceptedReady for checkin

comment:5 by Sarah Boyce <42296566+sarahboyce@…>, 7 weeks ago

Resolution: fixed
Status: assignedclosed

In 2c029c71:

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 01ed59f753139afb514170ee7f7384c155ecbc2d.

comment:6 by Sarah Boyce <42296566+sarahboyce@…>, 7 weeks ago

In 9fa2d23:

[5.1.x] 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 01ed59f753139afb514170ee7f7384c155ecbc2d.

Backport of 2c029c718f45341cdd43ee094c24488743c633e6 from main.

comment:7 by Namhong Kim, 7 weeks ago

Thank you, Sarah Boyce

Note: See TracTickets for help on using tickets.
Back to Top