diff --git a/djadmin2/static/themes/bootstrap/js/base.js b/djadmin2/static/themes/bootstrap/js/base.js new file mode 100644 index 0000000..90a2857 --- /dev/null +++ b/djadmin2/static/themes/bootstrap/js/base.js @@ -0,0 +1,13 @@ +$(document).ready(function() { + + /** + * Dynamicaly adds button to each input element + * Required by filter section to allow form to be submitted + */ + $("#filter_form").find('input').each(function(){ + var input_field = $(this); + + var btn = input_field.after(''); + }); + +}); diff --git a/djadmin2/templates/djadmin2/bootstrap/base.html b/djadmin2/templates/djadmin2/bootstrap/base.html index f65acf4..7090ce5 100644 --- a/djadmin2/templates/djadmin2/bootstrap/base.html +++ b/djadmin2/templates/djadmin2/bootstrap/base.html @@ -78,6 +78,7 @@ + {% endblock javascript %} diff --git a/djadmin2/templates/djadmin2/bootstrap/model_list.html b/djadmin2/templates/djadmin2/bootstrap/model_list.html index a260b63..8be3036 100644 --- a/djadmin2/templates/djadmin2/bootstrap/model_list.html +++ b/djadmin2/templates/djadmin2/bootstrap/model_list.html @@ -105,12 +105,16 @@ {% block filters %} - {% if list_filter %}
-

{# Translators : action verb #}{% trans "Filter" %}

- {{ list_filter.form.as_p }} + {% if list_filter %} +

{# Translators : action verb #}{% trans "Filter" %}

+
+ {{ list_filter.form.as_p }} +
+ {% else %} + Reset Filter + {% endif %}
- {% endif %} {% endblock filters %} diff --git a/example/blog/admin2.py b/example/blog/admin2.py index 7c220f7..8e1a946 100644 --- a/example/blog/admin2.py +++ b/example/blog/admin2.py @@ -25,7 +25,7 @@ class PostAdmin(djadmin2.ModelAdmin2): list_actions = [DeleteSelectedAction, CustomPublishAction, unpublish_items] inlines = [CommentInline] search_fields = ('title', '^body') - list_filter = ['published', ] + list_filter = ['published', 'title'] class CommentAdmin(djadmin2.ModelAdmin2):