答案 0 :(得分:2)
在你的模型中,你必须为python3包含 __ str __ ,为python 2包含 unicode
例如python 3:
class City(models.Model):
name = forms.CharField(max_length=200, default="")
def __str__(self):
return self.name
Python 2
class City(models.Model):
name = forms.CharField(max_length=200, default="")
def __unicode__(self):
return self.name