{% with id=widget.attrs.id %}
<div class="grouped field">
  <div{% if id %} id="{{ id }}"{% endif %} {% if widget.attrs.class %}{{ widget.attrs.class }}{% endif %}">
      {% for group, options, index in widget.optgroups %}
          {% for option in options %}
          {% include option.template_name with widget=option %}
          {% endfor %}
    {% endfor %}
  </div>
</div>
{% endwith %}
