{% load widget_tweaks formatting %}
{% if form %}
<div>
    {% for field in form.visible_fields %}
    <div class="form-row field-reference aligned">
        {{ field.errors }}

        {{ field.label_tag }}
        {% if readonly %}
        {% if field.name in form.files %}
        {% get_file_name form.files field.name %}
        {% else %}
        {% render_field field|attr:"readonly:readonly" %}
        {% endif %}
        {% else %}
        {% render_field field %}
        {% endif %}
        <div class="help">
            {{ field.help_text }}
        </div>
    </div>
    {% endfor %}
</div>

{% endif %}
