{% load attr2 %}
{% if toolbar_search_form %}
    <form class="form-inline">
        <span class="label label-xlg label-primary arrowed-right">层级过滤</span>
        {% for field in toolbar_search_form %}
            {{ field }}
        {% endfor %}
    </form>
    <script>
        {% for field in toolbar_search_form %}
            $('select[name="{{field.name}}"]').change(function () {
                var value = $(this).val();
                var obj = {'{{field.name}}': value, 'page': 1};
                {% if  hierarchy|attr2:field.name %}
                    {% for child in hierarchy|attr2:field.name %}
                        obj['{{child}}'] = '';
                    {% endfor %}
                {% endif %}
                updateHashParam(obj)
            });
        {% endfor %}
    </script>

{% endif %}