I have a table in my database, region
class region(models.Model):
region_name = models.CharField(primary_key=True,max_length=50, null=False)
@classmethod
def __unicode__(self):
return "hello"
When I am trying to add several new instances of region into the DB through the admin interface, so the title of all the existing regions is "hello", so I update the __unicode__(self)
function as
@classmethod
def __unicode__(self):
return u'%s' %(self.region_name)
but now the admin displays
Exception Type: AttributeError
Exception Value:
type object 'region' has no attribute 'region_name'
I have check my DB and there is region_name in the table for region. Can anyone help why this happens?