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?
--
Ticket URL: <https://code.djangoproject.com/ticket/21107>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* needs_better_patch: => 0
* resolution: => needsinfo
* needs_tests: => 0
* needs_docs: => 0
Comment:
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).
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:1>
* status: closed => new
* resolution: needsinfo =>
Comment:
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
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:2>
Comment (by claudep):
What is the encoding of your file (see preamble at the top of the file)?
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:3>
Comment (by Balicanta ):
{{{
# coding: utf-8
}}}
Top of the model.py, thanks
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:4>
* stage: Unreviewed => Accepted
Comment:
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.
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:5>
Comment (by mjtamlyn):
Does making the docstring a Unicode string help?
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:6>
* status: new => closed
* resolution: => invalid
Comment:
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`.
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:7>
Comment (by claudep):
Ah yes, I had the `from __future__ import unicode_literals` in my test
file, that's why I couldn't reproduce.
--
Ticket URL: <https://code.djangoproject.com/ticket/21107#comment:8>