You can test this case when "**log in**" page is displayed for admin.
In **django.contrib.admin.forms.AuthenticationForm**
{{{
def __init__(self, request=None, *args, **kwargs):
self.request = request
self.user_cache = None
super().__init__(*args, **kwargs)
self.username_field =
UserModel._meta.get_field(UserModel.USERNAME_FIELD)
self.fields['username'].max_length =
self.username_field.max_length or 254
if self.fields['username'].label is None:
# This is the line when character gets corrupted
self.fields['username'].label =
capfirst(self.username_field.verbose_name)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29693>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* Attachment "log_in_page.png" added.
screen of the page
* type: Uncategorized => Bug
* component: contrib.admin => Utilities
* stage: Unreviewed => Accepted
Comment:
Any idea how `django.utils.text.capfirst()` could be adapted to fix the
issue? I was thinking maybe we could check `ord()` of the first
character's `upper()` but I'm not sure if that's reliable.or not.
--
Ticket URL: <https://code.djangoproject.com/ticket/29693#comment:1>
Comment (by Claude Paroz):
I cannot reproduce this issue on a Linux/Python3.5 system.
{{{
>>> ord('მ')
4315
>>> ord('მ'.upper())
4315
}}}
What system are you using?
--
Ticket URL: <https://code.djangoproject.com/ticket/29693#comment:2>
Comment (by irakli khitarishvili):
Python : 3.7.0
System : Windows 7, Linux (Ubuntu 17.10)
--
Ticket URL: <https://code.djangoproject.com/ticket/29693#comment:3>
Comment (by Claude Paroz):
That's weird. However, I don't think that's something that Django can
change. It must be related to the underlying Unicode library mappings.
Maybe other people can test to see if the issue you are seeing is the
exception or the rule!
--
Ticket URL: <https://code.djangoproject.com/ticket/29693#comment:4>
Comment (by Carlton Gibson):
Repeating Claude's test on macOS with Python 3.6 and 3.7 and on Windows 10
(with both `cmd` and WSL bash) I get the same result:
{{{
>>> ord('მ')
4315
>>> ord('მ'.upper())
4315
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29693#comment:5>
Comment (by Tim Graham):
Looks like Python 3.7 is required to reproduce. Bisected to
https://github.com/python/cpython/commit/4705ea38c900f068fd262aca02943896d1123544.
On Ubuntu 18.04 with a manually installed Python 3.7:
{{{
>>> ord('მ'.upper())
7323
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29693#comment:6>
* status: new => closed
* resolution: => invalid
Comment:
Maybe a Unicode bug, then? Looks like `Მ` / `\u1C9B` / https
://unicode-table.com/en/1C9B/ has no information in Unicode. (not that
Unicode does have capitals for Georgian, see e.g. https://unicode-
table.com/en/10AB/).
Anyway, I fear the resolution will not take place in Django, but in Python
or in Unicode data. I'd suggest trying to report the issue in Python.
--
Ticket URL: <https://code.djangoproject.com/ticket/29693#comment:7>