Login

Accordion changelist admin

Author:
rodnsi
Posted:
November 25, 2009
Language:
HTML/template
Version:
Not specified
Tags:
admin changelist
Score:
3 (after 3 ratings)

Allows you to hide the filters in the pages of lists of admin. Very useful when filters hide one or more columns. Add this code after the block "extrastyle"

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#admin/templates/admin/change_list.html
...

{% block extrahead %}
  {{ block.super }}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<style type="text/css">
#changelist-filter h2 span{
        padding-right:15px;
}
#changelist-filter h2 span.slidedown{
        background: transparent url({% load adminmedia %}{% admin_media_prefix %}img/admin/arrow-up.gif) no-repeat scroll right 0.4em
}     

#changelist-filter h2 span.slideup {
        background: transparent url({% admin_media_prefix %}img/admin/arrow-down.gif) no-repeat scroll right 0.4em
        
}

#changelist-filter h2 {
        cursor:pointer;
}

</style>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
                $("#changelist-filter h2").append('<span class="slidedown">&nbsp;</span>');
                $("#changelist-filter h2").bind("click",function(){
                if ($("#changelist-filter ul, #changelist-filter h3").is(":hidden")) {
                        $("#changelist-filter h2 span").removeClass("slideup");
                        $("#changelist-filter h2 span").addClass("slidedown");
                        $("#changelist-filter ul, #changelist-filter h3").show("slow");
                
              } else {
                        $("#changelist-filter h2 span").removeClass("slidedown");
                        $("#changelist-filter h2 span").addClass("slideup");
                        $("#changelist-filter ul, #changelist-filter h3").slideUp();
              }
            });
});
</script>
{% endblock %}

...

More like this

  1. Accordion changelist admin by djm 4 years, 5 months ago
  2. Save Admin ChangeList Filter by msaron 3 years, 4 months ago
  3. Action that respects the filters in changeview_list by grillermo 2 years, 7 months ago
  4. Changelist filter by ForeignKey by overclocked 4 years, 6 months ago
  5. Return to a filtered changelist on change form save by richardbolt 4 years, 9 months ago

Comments

Please login first before commenting.