{% load i18n %}
<div class="{{ formset.prefix }} zotero-inline-tags">
  {% if media %}
      {{ formset.media }}
  {% endif %}
  {{ formset.management_form }}
  <input type="hidden" id="zotero-itemtype-url" value="{% url 'zotero_itemtype_fields' %}">
  <input type="hidden" id="zotero-formset-prefix" value="{{ formset.prefix }}">
  <input type="hidden" id="zotero-show-labels" value="{{ formset.show_labels }}">
  <input type="hidden" id="zotero-item_type-label" value="{{ formset.item_type_label }}">
  <input type="hidden" id="zotero-field-label" value="{{ formset.field_label }}">
  <input type="hidden" id="zotero-value-label" value="{{ formset.value_label }}">
  <input type="hidden" id="zotero-valid-itemtypes-fields-url" value="{% url 'valid_zotero_itemtypes_fields' %}">
  <fieldset>
    {{ formset.non_form_errors }}
    <table>
      <thead class="zotero-header-labels">
        <tr class="zotero-header">
          {% for field in formset.form.base_fields.values %}
            <th>
                {{ field.label|capfirst }}
            </th>
          {% endfor %}
          <th>{% trans "Delete?" %}</th>
        </tr>
      </thead>
      <tbody>
        {% for form in formset %}
          <tr class="{% cycle 'row1' 'row2' %} zotero-tag">
            {% for field in form %}
              <td class="field-{{ field.name }}">
                {{ field.errors.as_ul }}
                {{ field }}
              </td>
            {% endfor %}
          </tr>
        {% endfor %}
      </tbody>
    </table>
  </fieldset>
</div>
