{% extends "common/generic_modal.html" %}
{% load i18n form_tags %}
{% block modalbody %}
  <form id="{{ formid }}" class="form-horizontal" action="{{ action }}" method="POST">{% csrf_token %}
    <ul class="nav nav-pills" role="tablist">
      {% for tab in tabs %}
      <li class="{% if tabs.active_id == tab.id %}active{% endif %}">
        <a href="#{{ tab.id }}" role="tab" data-toggle="pill">{{ tab.title }}</a>
      </li>
      {% endfor %}
      {% block extratabs %}{% endblock %}
    </ul>
    <div class="tab-content">
      {% for tab in tabs %}
      <div class="tab-pane{% if tabs.active_id == tab.id %} active{% endif %}" id="{{ tab.id }}">
        {% if tab.formtpl %}
        {% render_form tab.instance tab.formtpl %}
        {% else %}
        {% render_form tab.instance %}
        {% endif %}
      </div>
      {% endfor %}
      {% block extratabs_content %}{% endblock %}
    </div>
  </form>
{% endblock %}
