2👍
✅
The exception shows that the error is thrown by the admin template trying to convert your object to a string:
{{ original|truncatewords:"18" }}
(from line 21 of the admin template). original
is the object being edited.
You are using Python 2, so make sure your model implements a proper __unicode__
method returning a unicode
object (so not encoded). If you have a __str__
method instead, that still returns unicode
, you’ll certainly run into the above exception; __str__
should only be used in Python 3 code. Alternatively, add the python_2_unicode_compatible()
decorator and use __str__
, see the __str__
method documentation.
Source:stackexchange.com