{% load widget_tweaks %}

{% for hidden_field in form.hidden_fields %}
    {{ hidden_field }}
{% endfor %}

{% if form.non_field_errors %}
    <div class="alert alert-danger" role="alert">
        {% for error in form.non_field_errors %}
            {{ error }}
        {% endfor %}
    </div>
{% endif %}
<div class="form-group">
    <div class="form-row">
        {% for field in form.visible_fields %}
            <div class="form-floating mb-3">
                {% if form.is_bound %}
                    {% if field.errors %}
                        {% render_field field class="form-control is-invalid" %}
                        {% for error in field.errors %}
                            <div class="invalid-feedback">
                                {{ error }}
                            </div>
                        {% endfor %}
                    {% else %}
                        {% render_field field class="form-control is-valid" %}
                    {% endif %}
                {% else %}
                    {% render_field field class="form-control" placeholder=field.label %}
                {% endif %}
                <label for="{{ field.id_for_label }}">{{ field.label }}</label>

                {% if field.help_text %}
                    <small class="form-text text-muted">{{ field.help_text }}</small>
                {% endif %}
            </div>
        {% endfor %}
    </div>
</div>