<select{{ field.input.attrs }}>
    {% for optgroup, choice_tuples in field.grouped_choice_tuples %}
        {% if optgroup %}
            <optgroup label="{{optgroup}}">
        {% endif %}
            {% for choice in choice_tuples %}
                <option value="{{ choice.1|stringformat:'s' }}" {% if choice.3 %}selected="selected"{% endif %}>{{ choice.2 }}</option>
            {% endfor %}
        {% if optgroup %}
            </optgroup>
        {% endif %}
    {% endfor %}
</select>
