Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#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


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)

螢幕快照 2013-09-16 下午3.10.16.png (122.7 KB) - added by anonymous 5 years ago.

Download all attachments as: .zip

Change History (9)

Changed 5 years ago by anonymous

comment:1 Changed 5 years ago by Claude Paroz

Resolution: needsinfo
Status: newclosed

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).

comment:2 Changed 5 years ago by balicanta

Resolution: needsinfo
Status: closednew

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):

that admin doc work correctly

comment:3 Changed 5 years ago by Claude Paroz

What is the encoding of your file (see preamble at the top of the file)?

comment:4 Changed 5 years ago by Balicanta

# coding: utf-8

Top of the, thanks

comment:5 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

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:6 Changed 5 years ago by Marc Tamlyn

Does making the docstring a Unicode string help?

comment:7 Changed 5 years ago by Tim Graham

Resolution: invalid
Status: newclosed

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 Changed 5 years ago by Claude Paroz

Ah yes, I had the from __future__ import unicode_literals in my test file, that's why I couldn't reproduce.

Note: See TracTickets for help on using tickets.
Back to Top