{% load form_helpers %} {% load helpers %}
{% for field in filter_form.hidden_fields %} {{ field }} {% endfor %} {% if filter_form.field_groups %} {# List filters by group #} {% for group in filter_form.field_groups %}
{% for name in group %} {% with field=filter_form|get_item:name %} {% render_field field %} {% endwith %} {% endfor %}
{% if not forloop.last %}
{% endif %} {% endfor %} {% else %} {# List all non-customfield filters as declared in the form class #} {% for field in filter_form.visible_fields %} {% if not filter_form.custom_field_filters or field.name not in filter_form.custom_field_filters %}
{% render_field field %}
{% endif %} {% endfor %} {% endif %} {% if filter_form.custom_field_filters %} {# List all custom field filters #}
{% for name in filter_form.custom_field_filters %}
{% with field=filter_form|get_item:name %} {% render_field field %} {% endwith %}
{% endfor %} {% endif %}