{% load i18n %}
    {% if extra_formset.non_form_errors %}<div class='errors'>{{extra_formset.non_form_errors.as_ul}}</div>{% endif %}
    {% if header %}<table class='inline-table' id='{{formset.prefix}}'>
    <caption>{% trans caption %}</caption>
    <thead>
    <tr>{% for field in formset.0.visible_fields%}
        <th>{{field.label}}</th>{%endfor%}
    </tr>
    </thead>{% endif %}{% for frm in formset%}
    {% if forloop.first and not skip %}<tbody>{%endif%}
    {% if not skip or not forloop.first %}
    {% if frm.errors %}<tr><td colspan='3'><ul>{% for error in frm.errors.values %}<li>{{error}}</li>{% endfor%}</ul></td></tr>{% endif %}
        <tr>{% endif %}{% for field in frm.visible_fields %}<td>
        {% if field.errors %}<div class='errors'>{{ field.errors.as_ul }}</div>{% endif %}
        {{ field|safe }}
        {# Include the hidden fields in the form #}
        {% if forloop.first %}
          {{ formset.management_form }}
          {% for hidden in frm.hidden_fields %}
          {{ hidden }}
          {% endfor %}
        {% endif %}
        </td>{% endfor %}
    {% if not skip or not forloop.last %}</tr>{% endif %}{%endfor%}
    {% if not skip %}</tbody>{% endif %}{% if header %}
    </table>{% endif %}
