#21107 closed Bug (invalid)
Django Admin doc Chinese description
Reported by: | Balicanta | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admindocs | Version: | 1.5 |
Severity: | Normal | Keywords: | Chinese |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I try to add admin doc in my project , and add some description to model's docstring, but it appear some error, and my description is Chinese
and I think the problem is cause by "contrib/admindocs/templates/admin_doc/model_detail.html line 29" and {% trans description %} , when I
remove the trans, the error will disappear, my question is the description really need trans?
Attachments (1)
Change History (9)
by , 11 years ago
Attachment: | 螢幕快照 2013-09-16 下午3.10.16.png added |
---|
comment:1 by , 11 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
comment:2 by , 11 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
Sorry, if i have a model like
class Song(models.Model): """ 歌曲 """
And that will appear the error , but if I change to
class Song(models.Model): """ Song """
that admin doc work correctly
comment:3 by , 11 years ago
What is the encoding of your file (see preamble at the top of the file)?
comment:5 by , 11 years ago
Triage Stage: | Unreviewed → Accepted |
---|
I can reproduce with the details above, the exception is a DjangoUnicodeDecodeError
:
Exception Value: 'ascii' codec can't decode byte 0xe6 in position 5: ordinal not in range(128). You passed in <django.utils.functional.__proxy__ object at 0x7fe4f4341b50> (<class 'django.utils.functional.__proxy__'>)
Not sure about the solution, but I don't think simply removing the {% trans %}
tag is the correct one.
comment:7 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Yes, that fixes the issue, thanks! So to summarize, this isn't an issue with Django but rather you need to make the docstring a unicode string by prefixing it with a u
or using from __future__ import unicode_literals
.
comment:8 by , 11 years ago
Ah yes, I had the from __future__ import unicode_literals
in my test file, that's why I couldn't reproduce.
I was not able to reproduce your problem. You should give us some minimal code to reproduce the error (and possibly the full traceback of the error).