{% load i18n %}
<form {% for k, v in formtable.form_attrs.items %}{{ k }}="{{ v }}" {% endfor %}>
  {% csrf_token %}
  {% for field in formtable.form.hidden_fields %}
  {{ field }}
  {% endfor %}
  <table {% for k, v in formtable.table_attrs.items %}{{ k }}="{{ v }}" {% endfor %}>
    <thead>
      <tr>
	<th class"row-select-placeholder"></th>
	<th colspan="{{ formtable.colspan }}">
	  <div class="aligned-center pagination">
	    <div class="pagination-left js-pagination-previous">
	      {% if formtable.page.has_previous %}
	      <a href="?page={{ formtable.page.previous_page_number }}">&lt;&lt;&lt;</a>
	      {% else %}
	      <span class="disabled">&lt;&lt;&lt;</span>
	      {% endif %}
	    </div>
	    <div class="pagination-center">
	      <span class="pagination-info js-pagination-page-no">
		  {% blocktrans with page_number=formtable.page_no page_count=formtable.page.paginator.num_pages trimmed %}
		  Page {{ page_number }} of {{ page_count }}.
		  {% endblocktrans %}
	      </span>
	      <span class="pagination-info js-pagination-items-per-page">
          {% blocktrans with n=formtable.results_per_page trimmed %}
          Results per page: {{ n }}
          {% endblocktrans %}
	      </span>
	    </div>
	    <div class="pagination-right js-pagination-next">
	      {% if formtable.page.has_next %}
	      <a href="?page={{ formtable.page.next_page_number }}">&gt;&gt;&gt;</a>
	      {% else %}
	      <span class="disabled">&gt;&gt;&gt;</span>
	      {% endif %}
	    </div>
	  </div>
	</th>
      </tr>
      <tr>
	<th>
	</th>
	<th colspan="{{ formtable.colspan }}" class="filter-fields">
	  {{ formtable.filters }}
	</th>
      </tr>
      <tr class="js-formtable-messages{% if not formtable.messages or formtable.form.non_form_errors %} hide{% endif %}">
	<th>
	</th>
	<th colspan="{{ formtable.colspan }}">
	  <ul class="messages">
	    {% for message in formtable.messages %}
	    <li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li>
	    {% endfor %}
	  </ul>
	  {{ formtable.form.non_form_errors }}
	</th>
      </tr>
      <tr>
	<th>
	</th>
	{% for header in formtable.columns %}
	<th>
	  {{ header }}
	  {% if header in formtable.sort_columns %}
	  <span class="js-sort-by sort-by">
	    <a class="disabled sort-up" href="#">▴</a><a class="disabled sort-down" href="#">▾</a>
	  </span>
	  {% endif %}
	</th>
	{% endfor %}
      </tr>
    </thead>
    {% if formtable.rows %}
    <tbody>
      {{ formtable.rows }}
    </tbody>
    {% endif %}
    <tfoot>
      <tr class="formtable-select">
	<td></td>
	<td colspan="{{ formtable.colspan }}">
	  <input type="checkbox" class="js-formtable-select-visible">{% blocktrans %}Select all{% endblocktrans %}
	  {{ formtable.select_all }} {{ formtable.select_all.label }}
	</td>
      </tr>
      <tr class="formtable-actions">
	<td></td>
	<td colspan="{{ formtable.colspan }}">
	  {{ formtable.actions.label }}
	  {{ formtable.actions }}
	  {{ formtable.actions.errors }}
	  {{ formtable.comment.label.lower }}
	  {{ formtable.comment }}
	  {{ formtable.comment.errors }}
      <input type="submit" class="btn" value={% trans "Go" %} />
	</td>
      </tr>
    </tfoot>
  </table>
</form>
