{% load bootstrap5_form %} {% comment %} One form field, in Bootstrap 5 markup. Widget classes are set in Python by bootstrap5_form.apply_classes, so this template only lays fields out. Errors use `invalid-feedback d-block` rather than plain `invalid-feedback`, because the latter is only revealed by a sibling `.is-invalid` and that relationship does not hold for the choice groups below. {% endcomment %} {% if field|is_checkbox %}
{{ field }} {% for error in field.errors %}
{{ error }}
{% endfor %} {% if field.help_text %}
{{ field.help_text|safe }}
{% endif %}
{% elif field|is_choice_group %}
{{ field.label }} {% for choice in field %}
{{ choice.tag }}
{% endfor %} {% for error in field.errors %}
{{ error }}
{% endfor %} {% if field.help_text %}
{{ field.help_text|safe }}
{% endif %}
{% else %}
{% if field.auto_id %} {% endif %} {{ field }} {% for error in field.errors %}
{{ error }}
{% endfor %} {% if field.help_text %}
{{ field.help_text|safe }}
{% endif %}
{% endif %}