Suppose I have the following Django (3.2) code:
class AType(models.IntegerChoices):
ZERO = 0, 'Zero'
ONE = 1, 'One'
TWO = 2, 'Two'
class A(models.Model):
a_type = models.IntegerField(choices=AType.choices)
Also, that I have a Django template with a variable a
:
{{a.a_type}} is a number.
How do I get "Zero" (the string associated with a_type)?