Opened 2 years ago

Closed 21 months ago

#33985 closed Bug (fixed)

ContentTypes and Permissions mix English with other languages in __str__

Reported by: Meiyer Owned by: Hrushikesh Vaidya
Component: contrib.admin Version: 3.0
Severity: Normal Keywords:
Cc: 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

The string representation of django.contrib.contenttypes.models.ContentType and django.contrib.auth.models.Permission was changed in commit 48c17807 to solve #16027. However, the __str__ function mixes the model’s app_label (which is not localized) with the model’s verbose_name (which is localized). This results in weirdly looking strings, part of which is in English and part in a different language, and maybe even different alphabet.

The comment https://code.djangoproject.com/ticket/16027#comment:21 does not clarify why the application’s app_label was chosen and not verbose_name (via self._meta.apps.get_app_config(self.app_label).verbose_name). In my opinion, either the whole of the ContentType’s representation should use localized labels or none of them should be localized.

Change History (7)

comment:1 by arka1002, 2 years ago

Owner: changed from nobody to arka1002
Status: newassigned

Hey! I'm going to work on it.

comment:2 by Carlton Gibson, 2 years ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

OK, this seems reasonable to at least look at fixing.

Is https://github.com/django/django/pull/15573 related? (It looks like it, but there's no ticket assigned yet, and no tests.)

comment:3 by arka1002, 2 years ago

Owner: arka1002 removed
Status: assignednew

comment:4 by Hrushikesh Vaidya, 2 years ago

Has patch: set
Needs tests: set
Owner: set to Hrushikesh Vaidya
Status: newassigned

PR
I'm not quite sure how and where to add tests for this patch. Could you give me some direction, @Carlton Gibson?

Version 0, edited 2 years ago by Hrushikesh Vaidya (next)

comment:5 by Josh Schneier, 23 months ago

Needs tests: unset

comment:6 by Mariusz Felisiak, 21 months ago

Triage Stage: AcceptedReady for checkin

comment:7 by Mariusz Felisiak <felisiak.mariusz@…>, 21 months ago

Resolution: fixed
Status: assignedclosed

In a52bdea5:

Fixed #33985 -- Used app_config.verbose_name in ContentType.str().

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