i’m trying to show hide the filter box(the grey box on the right) of the django admin change_list.html page.
I tried to create a simple javascript function and add it into the extra head like
{% extends "admin/change_list.html" %}
{% block extrastyle %}
{{ block.super }}
<script src="{{ STATIC_URL }}js/jquery-1.6.1.js" ></script>
<script>
function toggle-filter() {
$("#changelist-filter").toggle("slow");
};
</script>
{% endblock %}
Then I added a hyperlink and tried to get it to run that function like this
{% block object-tools %}
<ul class="object-tools">
<li><a onclick="toggle-filter()" id="hideBut" href="#" class="viewsitelink">{% trans "Toggle Filter" %}</a></li>
</ul>
{% endblock %}
But this doesn’t do anything. How can I get that filterbox to hide?
OK what I did was I added some javascript into the change_list.html like this:
Worked like a charm. I found the actual javascript here.