I have a Django model in which I'm using the choices parameter. For the choices, I'm using a Python Enum. Now I want to display the choices display value in a template. I know there's .get_fieldname_display but it just returns the key instead of the display value in this case.
Model:
class LocalTitle(models.Model):
type = models.CharField(max_length=8, choices=[(tag, tag.value) for tag in LocalTitleCodes])
title = models.CharField(max_length=255)
Enum:
class LocalTitleCodes(Enum):
title_00 = 'Japanese'
title_01 = 'English'
title_02 = 'French'
So in my case, if I do title.get_type_display in my template it returns title_00 and not Japanese. How can I get the display value?