{% load forms utils %}

<fieldset class="{% if title %}with-title{% else %}without-title{% endif %}{% if class %} {{ class }}{% endif %}">
    {% if title %}<legend>{{ title }}</legend>{% endif %}
    {% block above-form %}{% endblock %}
    {% if fieldsets %}
        {% for fieldset in fieldsets %}
            {% fieldset_renderer form fieldset %}
        {% endfor %}
    {% else %}
        <div class="container-fluid">
            {% for field_name_or_names in fields %}
                {% with field_names=field_name_or_names|to_list %}
                    <div class="form-group {{ field_names|join:' '}}">
                    {% for field_name in field_names %}
                        {% get_field form field_name as field %}
                        <div class="field {{ field_name }} {{ field|field_type }}{% if field.errors %} error{% endif %}">
                            {% include 'is_core/forms/default_field.html' with field=field field_name=field_name %}
                            {% block below-field %}{% endblock %}
                        </div>
                    {% endfor %}
                    </div>
                {% endwith %}
            {% empty %}
                <div class="form-group"></div>
            {% endfor %}
        </div>
    {% endif %}
    {% block below-form %}{% endblock %}
</fieldset>
