{% load l10n material_form material_form_internal %}

{% render bound_field template='fields/django_select.html' %}
    {% attr field 'widget' multiple %}True{% endattr %}
    {% attr field 'widget' class append %}material-ignore{% endattr %}
    {% attr field 'group' class append %}multiselect{% endattr %}
    {% part field options %}
        {% for group, items in bound_field|select_options %}
            {% for choice, value, selected in items %}
            <option value="{{ value|unlocalize }}"{% if selected %} selected="selected"{% endif %}>{{ choice }}</option>
           {% endfor %}
       {% endfor %}
    {% endpart %}
{% endrender %}

<script type="text/javascript">
if(! /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
    addEvent(window, "load", function(e) {
        SelectFilter.init("id_{{ bound_field.html_name }}", "{{ bound_field.html_name }}", 0, "/static/admin/");
    });
}
</script>
