{% load crispy_forms_filters %}
{% load l10n %}
<ul class="list-group{% if group_class %} {{ group_class }}{% endif %}"{% if flat_attrs %} {{ flat_attrs }}{% endif %}>
    {% for group, options, index in field|optgroups %}
        {% comment %}NOTE: Checkbox/Radio group is not supported{% endcomment %}
        {% comment %}{% if group %}<strong>{{ group }}</strong>{% endif %}{% endcomment %}
            {% for option in options %}
                <li class="list-group-item{% if item_class %} {{ item_class }}{% endif %}">
                    <input type="{{option.type}}" class="form-check-input me-1{% if field.errors %} is-invalid{% endif %}"  name="{{ field.html_name }}" value="{{ option.value|unlocalize }}" {% include "bootstrap5/layout/attrs.html" with widget=option %}>
                    <label for="{{ option.attrs.id }}" class="form-check-label">
                        {{ option.label|unlocalize }}
                    </label>
                    {% if field.errors and forloop.last and not inline_class and forloop.parentloop.last %}
                        {% include 'bootstrap5/layout/field_errors_block.html' %}
                    {% endif %}
                </li>
            {% endfor %}
    {% endfor %}
</ul>
{% if field.errors and inline_class %}
    {% for error in field.errors %}
        <p id="error_{{ forloop.counter }}_{{ field.auto_id }}" class="invalid-feedback"><strong>{{ error }}</strong></p>
    {% endfor %}
{% endif %}
{% include 'bootstrap5/layout/help_text.html' %}
