class Foo(models.Model):
class Bar(models.TextChoices):
CODE_A = 'A', "special code A"
CODE_B = 'B', "not so special code B"
bar = models.CharField(max_length=1, choices=Bar.choices)
The text choices look like tuples but they aren't:
print(Foo.Bar.CODE_A[1])
Gives "IndexError: string index out of range". I was expecting to get "special code A". How do I access the code string programmatically from a view, not from within a template and not just the code constant?