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: enter image description here

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

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -