{% macro render_inline_fields(field, template, render, check=None) %}
<div class="inline-field">
    <div class="inline-field-list">
        {% for subfield in field %}
        <div id="{{ subfield.id }}" class="inline-field well">
            {%- if not check or check(subfield) %}
                {% if subfield.get_pk and subfield.get_pk() %}
                <div class="inline-field-control">
                    <input type="checkbox" name="del-{{ subfield.id }}" id="del-{{ subfield.id }}" />
                    <label for="del-{{ subfield.id }}" style="display: inline">{{ _gettext('Delete?') }}</label>
                </div>
                {% else %}
                <div class="inline-field-control">
                    <a href="javascript:void(0)" class="inline-remove-field"><i class="glyphicon glyphicon-remove"></i></a>
                </div>
                {% endif %}
            {%- endif -%}

            {{ render(subfield) }}
        </div>
        {% endfor %}
    </div>
    <div class="inline-field-template hide">
        {% filter forceescape %}
        <div class="inline-field panel panel-info">
            <div class="inline-field-control">
                <a href="javascript:void(0)" class="inline-remove-field"><span class="glyphicon glyphicon-remove"></span></a>
            </div>
            {{ render(template) }}
        </div>
        {% endfilter %}
    </div>
    <a id="{{ field.id }}-button" href="javascript:void(0)" class="btn btn-default" onclick="faForm.addInlineField(this, '{{ field.id }}');">{{ _gettext('Add') }} {{ field.label.text }}</a>
</div>
{% endmacro %}
