unicode - UnicodeEncodeError at /admin/ in Django app -
unicode - UnicodeEncodeError at /admin/ in Django app -
i next error @ admin pages when seek view list of existing objects.
unicodeencodeerror @ /admin/character/charlevel/ 'ascii' codec can't encode character u'\xd6' in position 0: ordinal not in range(128) request method: request url: http://127.0.0.1:8000/admin/character/charlevel/ django version: 1.4.1 exception type: unicodeencodeerror exception value: 'ascii' codec can't encode character u'\xd6' in position 0: ordinal not in range(128) exception location: /home/***/workspace/***/***/character/models.py in __unicode__, line 413 python executable: /usr/bin/python python version: 2.7.3
this occurs when open object list of class:
class charlevel(models.model): char = models.foreignkey(character) prof = models.foreignkey(profession) level = models.smallintegerfield() def __unicode__(self): homecoming ('{c}/{l}/{p}'.format(c=self.char.name, l=self.level, p=self.prof )).encode('utf-8')
the issue disappear if remove {c}
component of string format
however problem not occur class charater next __unicode__
:
class character(models.model): name = models.charfield(max_length=32) def __unicode__(self): homecoming self.name
what have done wrong?
__unicode__
should homecoming unicode
:
def __unicode__(self): homecoming u'{c}/{l}/{p}'.format(c=self.char.name, l=self.level, p=self.prof)
django unicode utf-8 ascii admin
Comments
Post a Comment