{% with id=widget.attrs.id %} {% comment %} the 'widget' variable is a dict, NOT the widget instance {% endcomment %} {% for group, options, index in widget.optgroups %} {% for option in options %}
{% include "django/forms/widgets/input.html" with widget=option %}
{% endfor %} {% endfor %} {% endwith %}