Django: Template should render 'description' not actual value
Posted
by Till Backhaus
on Stack Overflow
See other posts from Stack Overflow
or by Till Backhaus
Published on 2010-03-03T16:55:23Z
Indexed on
2010/04/26
6:13 UTC
Read the original article
Hit count: 209
django
|django-templates
Hi,
in a Model I have a CharField with choices:
class MyModel(models.Model):
THE_CHOICES=(
('val',_(u'Value Description')),
)
...
myfield=models.CharField(max_length=3,choices=THE_CHOICES
Now in the template I access an instance of MyModel:
{{ my_instance.myfield }}
Of course the gives me val
instead of Value Description
. How do I get the description?
Thanks in advance!
© Stack Overflow or respective owner