Opened 11 years ago

Closed 11 years ago

Last modified 11 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

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)

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

Download all attachments as: .zip

Change History (9)

comment:1 by Claude Paroz, 11 years ago

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 by balicanta, 11 years ago

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

that admin doc work correctly

comment:3 by Claude Paroz, 11 years ago

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

comment:4 by Balicanta , 11 years ago

# coding: utf-8

Top of the model.py, thanks

comment:5 by Tim Graham, 11 years ago

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 by Marc Tamlyn, 11 years ago

Does making the docstring a Unicode string help?

comment:7 by Tim Graham, 11 years ago

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 by Claude Paroz, 11 years ago

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