0
i already got the answer…..but thnx for ur rply
def __str__(self):
return str(self.id)
def __unicode__(self):
return unicode(self.id)
1
First of all you don’t have to implement both methods. If you’re using python 2
then use __unicode__
. If you’re using python 3
use __str__
.
So, using python 2 do this:
def __unicode__(self):
return '{}'.format(self.id)
For python 3 do this:
def __str__(self):
return '{}'.format(self.id)
Source:stackexchange.com