Unicode chars in verbose_name results in UnicodeDecodeError instead of 404 in generic views
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
If you name your model in Meta class using verbose_name and you use some non-ASCII character in it, it breaks DetailView for that object. If you call DetailView with existing ID, it works, but when you try to retrieve non-existent object (using non-existent PK), it will return 'UnicodeDecodeError 'ascii' codec can't decode byte 0xc4 in position 0: ordinal not in range(128)' instead of 404. When you append "u" to that string or don't use "verbose_name" at all, it works.
Note that you can use UTF-8 chars in verbose_name_plural and it works.
And yes, I have "# -*- coding: utf-8 -*-" on the first line of that file. I have named everything with utf-8 characters and I don't have problem with anything other.
You can see the traceback here: http://dpaste.com/hold/1006177/
Change History (6)
comment:1 Changed 4 years ago by
|Patch needs improvement:||unset|