Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
java script trick to hide the "filter" in a django admin view
ListFilterCollapsePrototype = {
bindToggle: function(){
var that = this;
init: function(filterEl) {
this.$filterTitle = $(filterEl).children('h2');
this.$filterContent = $(filterEl).children('h3, ul');
$(this.$filterTitle).css('cursor', 'pointer');
this.$list = $('#changelist');
function ListFilterCollapse(filterEl) {
ListFilterCollapse.prototype = ListFilterCollapsePrototype;
var collapser = new ListFilterCollapse(this);

drn8 commented Jun 3, 2013

Hi, thanks for your job first of all. I say to my self, if there is a way to start the admin view with list filter collapsed already. Thanks in advance

I wrote a snippets for menu collapse and single element menu collapse.

It's a fork from abyx code, I've just extended it.

If a filter was previously activated the element menu related to this will start as opened.

The filter menu starts closed as default.
Hope this helps

ps = I love moretti beer too ! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment