代碼:模型.__的unicode __()返回俄羅斯字符串原因TemplateSyntaxError
class Gallery(models.Model):
title = models.CharField(max_length=100)
description = models.TextField(blank=True)
created = models.DateField(auto_now_add=True)
class Meta:
verbose_name = 'галерея'
verbose_name_plural = 'галереи'
def __unicode__(self):
return 'Галерея %s' % self.title
錯誤:
TemplateSyntaxError at /admin/galleries/gallery/
Caught an exception while rendering: ('ascii', '\xd0\x93\xd0\xb0\xd0\xbb\xd0\xb5\xd1\x80\xd0\xb5\xd1\x8f ', 0, 1, 'ordinal not in range(128)')
我該怎麼辦?
這是頭號Django的錯誤我看到的開始。經驗法則:'__unicode__'必須*總是*返回unicode。 – 2010-02-25 16:02:35