{% load util %}
{% load form_util %}
<div class="aw-error-msg">
    {{ form.non_field_errors }}
</div>
<button type="submit" class="btn btn-primary" title="Save">Save</button>
{% for bf in form.visible_fields %}
    <div class="mb-3 row">
        <label for="{{ bf.id_for_label }}" class="form-label col-sm-2 col-form-label">{{ bf.label }}</label>
        <div class="col-sm-10">
{%  if bf|form_field_is_dropdown %}
            {{ bf|get_form_field_select:existing|safe }}
{% else %}
            {{ bf|get_form_field_input:existing|safe }}
{% endif %}
        </div>
{%  if bf.help_text|exists %}
        <div class="help-block">
            <b>Info:</b> {{ bf.help_text|safe }}
        </div>
{%  endif %}
        <div class="aw-error-msg">
            {# for debugging #}
            {# bf.field|to_dict #}{# existing; todo: fix select existing values in dropdown #}
            {# existing #}
            {{ bf.errors }}
        </div>
    </div>
{% endfor %}
<button type="submit" class="btn btn-primary" title="Save">Save</button>
