{% comment %} Template to display a form using styling from the form and pure-css. Parameters that can be passed (in the with clause of an include) are: action: Url to send the submitted form to e.g.'/search/' default is '.' i.e. the current url aligned: Boolean variable, if true the 'pure-form-aligned' class is applied if false the class 'pure-form-stacked' is appled form_class: Additional css classes to apply to the form tag form_id: Id attribute for the form e.g. id_search_form inline_checkbox: Boolean variable, if true checkboxes are displayed inline regardless of whether the form is stacked or aligned, styling is determined by aligned variable legend: Legend to display at the top of the form method: The submit method, e.g. GET, POST submit: Legend for the submit button (default is 'Submit') submit_id: Id of the submit button submit_2_id and submit_2_name and submit_2_value: three variables to allow definition of a second submit button and define it's id, name and value. {% endcomment %}
{% if not no_token %} {% csrf_token %} {% endif %} {% if form.non_field_errors %} {{ form.non_field_errors }} {% endif %}
{% if legend %} {{ legend }} {% endif %} {% for field in form.visible_fields %} {% if inline_checkbox and field.field.widget.input_type %} {% include '_form_field.html' with field=field field_type=field.field.widget.input_type %} {% else %} {% include '_form_field.html' with field=field %} {% endif %} {% endfor %} {% if formset %} {{ formset.management_form }} {% endif %} {% for formset_form in formset %} {{ formset_legend }} {% if formset_add %} {{ forloop.counter|add:formset_add }}: {% else %} {{ forloop.counter }}: {% endif %} {% for field in formset_form.visible_fields %} {% if inline_checkbox %} {% include '_form_field.html' with field=field field_type=field.field.widget.input_type %} {% else %} {% include '_form_field.html' with field=field %} {% endif %} {% endfor %} {% for hidden in formset_form.hidden_fields %} {{ hidden }} {% endfor %} {% endfor %}

{% if submit_2_id and submit_2_name and submit_2_value %} {% endif %}

{% for hidden in form.hidden_fields %} {{ hidden }} {% endfor %} {% if next %} {% endif %}