{% with id=widget.attrs.id %}
{% for group, options, index in widget.optgroups %} {% for option in options %} {% if option.value != '' %} {% include option.template_name with widget=option %} {% endif %} {% endfor %} {% endfor %}
{% endwith %}