【发布时间】:2011-04-12 12:56:35
【问题描述】:
谁能给我一个提示,为什么模型实例名称中的元音变音一旦变成垃圾,但在 unicode() 被 'print()'ed 时正确打印?
class Geo(Position):
name = models.CharField(max_length = 161)
def __unicode__(self):
return u'%s' % self.name
在外壳中:
In [10]: Geo.objects.get(pk=1)
Out[10]: <Geo: Eichstätt>
In [11]: print Geo.objects.get(pk=1).__unicode__()
Eichstätt
【问题讨论】:
标签: django unicode model string