Reputation: 939
I have a constant array in my model:
DELIVERY_TYPES = (
('self', u'one'),
('paid', u'two'),
('free', u'3')
)
in my django template I'am trying to render it:
<span style="font-size: 20px;">{{ DELIVERY_TYPES[shop.delivery_type] }}</span>
I get an error, how to print these values right?
Upvotes: 0
Views: 226
Reputation: 308839
You can use:
{{ shop.get_delivery_type_display }}
See the docs on get_FOO_display
for more info.
Upvotes: 4