{% macro render_inline_fields(field, template, render, check=None) %}
<div class="inline-field">
    <div id="{{ field.id }}-fields">
        {% for subfield in field %}
        <div id="{{ subfield.id }}" class="fa-inline-field">
            {%- if not check or check(subfield) %}
                {% if subfield.get_pk and subfield.get_pk() %}
                <div class="fa-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="fa-inline-field-control">
                    <a href="javascript:void(0)" class="fa-remove-field"><i class="icon-remove"></i></a>
                </div>
                {% endif %}
            {%- endif -%}

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