Question

I added standart comment model ('django.contrib.comments' with 'django.contrib.sites',) from django tutorial, it works fine. But when i try to show comment list in Comments administration, it causes error:

UnicodeDecodeError at /admin/comments/comment/
'utf8' codec can't decode byte 0xc2 in position 80: invalid continuation byte
Request Method: GET
Request URL:    http://127.0.0.1:8000/admin/comments/comment/
Django Version: 1.6.4
Exception Type: UnicodeDecodeError
Exception Value:    
'utf8' codec can't decode byte 0xc2 in position 80: invalid continuation byte
Exception Location: C:\Python27\lib\encodings\utf_8.py in decode, line 16
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.6

Unicode error hint

The string that could not be encoded/decoded was: ONE '������
Error during template rendering

In template C:\Users\Harkonnen\PycharmProjects\alpha\grappelli\templates\admin\change_list.html, error at line 207
utf8
205         <!-- DATE HIERARCHY -->
206         {% block date_hierarchy %}
207             {% if cl.date_hierarchy %}{% date_hierarchy cl %}{% endif %}
208         {% endblock %}

Is it possible to solve this error without edit standart django or grappeli models?

Upd: withut grappelli same error =(

In template C:\Python27\lib\site-packages\django\contrib\admin\templates\admin\change_list.html, error at line 73

73        {% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
Was it helpful?

Solution 2

Сomments use pytz for timezones. Installed it and the error is gone.

OTHER TIPS

In your settings.py file do you have another config for DEFAULT_CHARSET?

Look this: https://docs.djangoproject.com/en/dev/ref/settings/#default-charset

Elsewhere of Django's documentation, mentioned:

Django natively supports Unicode data everywhere.

https://docs.djangoproject.com/en/1.7/ref/unicode/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top