unicode problems in admin interface

81 views
Skip to first unread message

Jaap van Wingerde

unread,
Sep 18, 2014, 1:59:55 PM9/18/14
to django...@googlegroups.com
I have suddenly unicode problems with de admin interface:

"DjangoUnicodeDecodeError at /admin/art/photographextra/

'ascii' codec can't decode byte 0xc3 in position 32: ordinal not in
range(128). You passed in <exposition: [Bad Unicode data]> (<class
'art.models.exposition'>)
...
Unicode error hint

The string that could not be encoded/decoded was: l>Mus��e du"

The site itself is behaving well:
<http://glaskunst.liakoster.nl/expositie/medium-verre-21/>.

settings.py:
"...
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'grappelli.dashboard',
'grappelli',
# Uncomment the next line to enable the admin:
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
'django.contrib.admindocs',
'art',
'rosetta',
'dbgettext',
)
...
DEFAULT_CHARSET='utf-8'
FILE_CHARSET='utf-8'
DEFAULT_CONTENT_TYPE='text/html'
..."

"jaap@liakoster:/var/django/liakoster.nl/test2$ python -c "import
django; print(django.get_version())" 1.7
jaap@liakoster:/var/django/liakoster.nl/test2$ python -V
Python 2.7.3
jaap@liakoster:/var/django/liakoster.nl/test2$"



What is going on?


--

Jaap van Wingerde
e-mail: 12345...@vanwingerde.nl

signature.asc

Collin Anderson

unread,
Sep 19, 2014, 10:58:59 PM9/19/14
to django...@googlegroups.com
Are you uploading a file using apache? It could be the /etc/apache2/envvars issue.

Are you ever using string formatting like "something %s something" % something ? If so, use unicode_literals or change that to a unicode string: u"something %s something" % something

Jaap van Wingerde

unread,
Sep 20, 2014, 9:05:14 PM9/20/14
to django...@googlegroups.com
Op 2014-09-19T15:58:59 UTC schreef Collin Anderson
<cmawe...@gmail.com> in het bericht <Re: unicode problems in admin
interface>, ID: <f2c7c2e5-9d58-4e31...@googlegroups.com>
interface> het volgende.

> Are you uploading a file using apache? It could be
> the /etc/apache2/envvars issue.

No, it is an issue with Django/admin.

> Are you ever using string formatting like "something %s something" %
> something ? If so, use unicode_literals or change that to a unicode
> string: u"something %s something" % something

models.py:
"...
def img(self):
return format_html(u'<a href="/foto/{2}" target="_blank"><img
title="{1}" height="80"
src="http://glaskunst.liakoster.nl/media/img/height_80/{2}.jpg"/></a>',
self.id,self.photograph)
image.allow.tags = True
def __unicode__(self):
return self.photograph
..."

Coulld it be a bug in Django 1.7?
signature.asc

Jaap van Wingerde

unread,
Sep 22, 2014, 11:29:18 AM9/22/14
to django...@googlegroups.com
Op 2014-09-18T13:41:53 UTC schreef Jaap van Wingerde
<mailin...@vanwingerde.nl> in het bericht <unicode problems in admin
interface>, ID: <20140918134...@jaap.custard.shrl.nl> het
interface>volgende.
I found a way around by removing 'artobjects' from list_filter:
"# list_filter = ('expositions','galleries','creators','objectseries','artobjects',)
list_filter = ('expositions','galleries','creators','objectseries',)"

This problem is like the following bugs:
<https://github.com/darklow/django-suit/pull/162> and
<https://github.com/darklow/django-suit/issues/46>. However, I do not
use django-suite.
signature.asc
Reply all
Reply to author
Forward
0 new messages