{% load crispy_forms_filters l10n %} {% comment %}Based on crispy original, just adds color field special handling.{% endcomment %}
{% for group, options, index in field|optgroups %} {% if group %}{{ group }}{% endif %} {% for option in options %} {% if field.name == "color" %} {% else %}
{% if field.errors and forloop.last and not inline_class and forloop.parentloop.last %} {% include 'bootstrap5/layout/field_errors_block.html' %} {% endif %}
{% endif %} {% endfor %} {% endfor %}
{% if field.errors and inline_class %} {# djlint:off #} {% if field.errors.field_id %} {# Django 5.2+ #}
{% else %}
{% endif %} {% for error in field.errors %}

{{ error }}

{% endfor %}
{# djlint:on #} {% endif %} {% include 'bootstrap5/layout/help_text.html' %}