#23723 closed Bug (invalid)
UTF-8 string in AppConfig's verbose_name crashes admin site
| Reported by: | Igor Koshkarov | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | 1.7 |
| Severity: | Normal | Keywords: | AppConfig verbose_name |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
If verbose_name in django.apps.AppConfig has UTF-8 chars, the admin.site application crashes with the following output:
UnicodeDecodeError at /admin/App/
'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
Request Method: GET
Request URL: http://localhost:8000/admin/App/
Django Version: 1.7.1
Exception Type: UnicodeDecodeError
Exception Value:
'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)
Python Version: 2.7.5
The testcase is attached to this ticket.
Attachments (1)
Change History (3)
by , 11 years ago
| Attachment: | SitesErr.tar added |
|---|
comment:1 by , 11 years ago
| Resolution: | → invalid |
|---|---|
| Status: | new → closed |
You are not supposed to define non-ASCII bytestrings, and that's the case in many other locations in Django.
Either use a the unicode prefix u"..." or add from __future__ import unicode_literals at the top of your file.
Thanks for the example case, that's very useful to quickly find the problem!
TestCase