django - __unicode__(self) for python3 and Django1.8 not working -
use python3 , django1.8 admin.py manage db:
class employee(models.model): name = models.charfield(max_length=20) sex = models.charfield(max_length=1,choices=sex_choices) def __unicode__(self): return self.name
i want return object's name,so use __unicode__(self)
return self.name
but result:
it's show object ,not name!!!!
what should do??
i believe, in python 3 django need define __str__() instead of __unicode__().
i found information in section "__str__() , __unicode__() methods" here.
Comments
Post a Comment