Post date: Jan 27, 2011 10:02:27 AM
In Building model there are choices for status:
BUILDING_STATUS = ( ('project', 'Planning'), ('inprogress', 'Working'), ('ready', 'Ready'),)Once I found in code smth like this:
{% if building.status == 'project' %}Planning{% endif %}{% if building.status == 'inprogress' %}Working {% endif %}{% if building.status == 'ready' %}Ready{% endif %}YOU SHOULD NOT DO THAT. It s ugly! Adding one status is painful as you need to rewrite all templates.
Solution? Django already do useful helper for you:
{{ building.get_status_display }}