Created
June 10, 2014 07:03
-
-
Save barseghyanartur/44d7b0f659a4798b2807 to your computer and use it in GitHub Desktop.
Allow django admin filter to be hidable (https://code.djangoproject.com/ticket/15935, https://code.djangoproject.com/attachment/ticket/15935/patch_hide_admin_filter.diff)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Index: django/contrib/admin/templates/admin/change_list.html | |
=================================================================== | |
--- django/contrib/admin/templates/admin/change_list.html (revisión: 16133) | |
+++ django/contrib/admin/templates/admin/change_list.html (copia de trabajo) | |
@@ -27,6 +27,18 @@ | |
(function($) { | |
$(document).ready(function($) { | |
$("tr input.action-select").actions(); | |
+ | |
+ $('#display-filter').click(function(event) { | |
+ $('#changelist').addClass('filtered'); | |
+ $('#changelist-filter').show('slow'); | |
+ $('#display-filter').hide('slow'); | |
+ }); | |
+ $('#change-title').click(function(event) { | |
+ $('#changelist').removeClass('filtered'); | |
+ $('#changelist-filter').hide('slow'); | |
+ $('#display-filter').show('slow'); | |
+ }); | |
+ | |
}); | |
})(django.jQuery); | |
</script> | |
@@ -80,8 +92,12 @@ | |
{% block filters %} | |
{% if cl.has_filters %} | |
+ <h2 id="display-filter" style="display:none"> | |
+ {% trans 'Filter' %}: | |
+ {% for spec in cl.filter_specs %} {{ spec.title }}{{ spec.choices }}{% endfor %} | |
+ </h2> | |
<div id="changelist-filter"> | |
- <h2>{% trans 'Filter' %}</h2> | |
+ <h2 id="change-title">{% trans 'Filter' %}</h2> | |
{% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %} | |
</div> | |
{% endif %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment