{% load assets %}
<script id="row-to-copy" type="x-tmpl-mustache">
  {% multi_assign_form empty_formset|first %}
</script>
<form method="POST" class="form form-inline form-split">
  {% csrf_token %}
  {{ formset.management_form }}
  <div class="row">
    <table class="table table-striped table-bordered table-condensed">
      <thead><tr>
        <th>#</th>
        {% for field in empty_formset|first %}
            {% if not field.is_hidden %}
              <th>{{ field.label }}</th>
            {% endif %}
        {% endfor %}
      </tr></thead>
      <tbody>
       {% for form in formset %}
          {% multi_assign_form form forloop.counter %}
        {% endfor %}
      </tbody>
    </table>
  </div>
  <div class="row">
    <a href="#" class="btn btn-success add_row">+</a>
    <div class="form-actions">
      <button type="submit" class="btn btn-primary">Save</button>
    </div>
  </div>
</form>
