use python3 and Django1.8 admin.py to 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 i use __unicode__(self)
return self.name
but result:
it's only show object ,not the name!!!!
what should i do??
I believe, in python 3 with django you need to define __str__() instead of __unicode__().
I found information about this in section "__str__() and __unicode__() methods" here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With