{% if not fields_only %}
    <form method="{{ request_method|default:'get' }}" action="{{ action_url|default:'' }}">
    {% csrf_token %}
{% endif %}

{% for error in form.non_field_errors %}
    <div class="alert alert-danger">{{ error }}</div>
{% endfor %}

{% for field in form.visible_fields %}

    <div class="my-4">
        {{ field.label }}
        {{ field }}
    </div>
    
    {% if field.errors %}
    
        {% for error in field.errors %}
            <div class="alert alert-danger">{{ error }}</div>
        {% endfor %}

    {% endif %}

{% endfor %}

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

{% if not fields_only %}
    <button class="btn btn-success">{{ btn_text|default:'Submit' }}</button>
    </form>
{% endif %}