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 , 2 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 2 years ago
Triage Stage: | Unreviewed → Accepted |
---|---|
Type: | Uncategorized → Bug |
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 , 2 years ago
Owner: | removed |
---|---|
Status: | assigned → new |
comment:4 by , 2 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Owner: | set to |
Status: | new → assigned |
PR
I'm not quite sure how and where to add tests for this patch. Could you give me some direction, @Carlton Gibson?
comment:5 by , 23 months ago
Needs tests: | unset |
---|
comment:6 by , 21 months ago
Triage Stage: | Accepted → Ready for checkin |
---|
Hey! I'm going to work on it.