I use nested tuples to organize and display choices in the admin section, and I would like to access the first element of the chosen tuple. In the example below, assuming the selected media is vinyl I would like get Audio. How can I do that ?
from django.db import models
class Student(models.Model):
MEDIA_CHOICES = [
('Audio', (
('vinyl', 'Vinyl'),
('cd', 'CD'),
)
),
('Video', (
('vhs', 'VHS Tape'),
('dvd', 'DVD'),
)
),
('unknown', 'Unknown'),
]
media = models.CharField(max_length=20, choices=MEDIA_CHOICES)