{% with optgroups=widget.optgroups %} {% for group, options, index in optgroups %} {% if group %}
{{ group }} {% endif %} {% for option in options %} {% if separate_last_option %} {% if is_flat_list and optgroups|length > 1 and index == optgroups|length|add:'-1' %}

{{ last_option_label|default:_('or') }}

{% elif options|length > 1 and forloop.last %}

{{ last_option_label|default:_('or') }}

{% endif %} {% endif %} {% include option.template_name with widget=option %} {% endfor %} {% if group %}
{% endif %} {% endfor %} {% endwith %}