{% load i18n %}
  {% if form.non_field_errors %}<p class='errors'>
    {{form.non_field_errors}}
  </p>{%endif%}
  {% for hidden in form.hidden_fields %}{{ hidden }}{% endfor %}
  {% for field in form.visible_fields %}
{% if forloop.counter0 == 0 %}
<ul class='form-flex head-form'>
{% endif %}
{% if forloop.counter0 == 9 %}
</ul>
<p class='center'><a href='#' onclick='show_hide_flex(".tail-form");return false'>{% trans "Show / hide advanced search" %}</a></p>
<ul class='form-flex tail-form hidden'>
{% endif %}
  <li{% if field.field.required %} class='required'{% endif %}>
    {{ field.label_tag }}
    <p class='input'>{{ field.errors }}{{field|safe}}</p>{% if field.help_text %}
    <a href="#{{field.auto_id}}" class="help_display" title="{% trans "Help"%}">?</a>
  <div class="help_text" id="{{field.auto_id}}_help">
    {{field.help_text}}</div>
  {%endif%}</li>
{% if forloop.last %}
</ul>
{% endif %}
{% endfor %}
