model choice field

18 views
Skip to first unread message

shahab emami

unread,
Jun 22, 2017, 4:09:24 AM6/22/17
to Django users
hello

i have a model choice field like this:

LEVEL_CHOICES = [
        ('1', 'one'),
        ('2', 'two'),
        ('3', 'three'),
    ]

but when i select from database and say:

{{object.level}}

 it shows me 1 or 2 or 3 but i wanted to be one or two or three

how can i do that?

i did some search but i got nothing , actually i dont now what i have to search for this problem

thank you

Daniel Roseman

unread,
Jun 22, 2017, 5:18:03 AM6/22/17
to Django users
{{ object.get_level_display }}

--
DR.
Reply all
Reply to author
Forward
0 new messages