当我在模型部分定义一个类时,我编写了一个__unicode__
方法。但它仍然显示类名+对象形式。像,Publisher 对象
class Publisher(models.Model):
name = models.CharField(max_length = 30)
address = models.CharField(max_length = 50)
city = models.CharField(max_length = 60)
state_province = models.CharField(max_length = 30)
country = models.CharField(max_length = 50)
website = models.URLField()
def __unicode__(self):
return self.name