Change template when TOTAL_FORMS = 0 - Django -
what want display div depending on number of forms:
<div id="form-nav"> <div id="add-event"> <input type="submit" name="add_event" value="add event"> </div> {% if formset.total_forms == 0 %} <div id="save-next"> <input type="submit" name="coding_form_next" value="save without event"> </div> {% elif %} <div id="save-stay"> <input type="submit" name="coding_form_save" value="save new events"> </div> {% endif %} </div> however, following error:
unexpected end of expression in if tag. what doing wrong?
change {% elif %} {% else %}
the if/else structure of django templates
{% if condition_here %} {% elif another_condition_here %} {% endif %} or
{% if condition_here %} {% else %} {% endif %} and of course simplest
{% if condition_here %} {% endif %} and here's docs
Comments
Post a Comment