55👍
✅
Use get_gender_display()
:
return u"%s [%s]" % (self.name, self.get_gender_display())
Note, if you’re not using Python 3+ you should be defining __unicode__
rather than __str__
.
Source:stackexchange.com