[Django]-Display field choice as part of model string name

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__.

Leave a comment