I have the following in my django model:
PRIORITY = (
(1, 'Low'),
(2, 'Normal'),
(3, 'High'),
)
Obviously the entry associated with this is storing the integer. In my template however I would like to show the priority in human-readable format. How exactly do I accomplish this?
My template:
{% for x in items %}
{{ x }} (added on {{ x.create_date }})<br>
{% endfor %}
{{ x.id }} would be the priority ID.
Thanks in advance.
Really, the “priority” with name and ID is a self-invented kind of object that you’ve thought up. If you just make this a Priority model and treat it as such it will all work the way it should. It’s because you’re trying to avoid using the system that you’re having trouble.