This commit is contained in:
Daniel Greenfeld 2013-07-07 11:48:56 +02:00
commit 4d5b170e10
4 changed files with 23 additions and 5 deletions

View file

@ -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('<button>Go</button>');
});
});

View file

@ -78,6 +78,7 @@
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="{{ STATIC_URL }}themes/bootstrap/js/jquery.min.js">\x3C/script>')</script>
<script src="{{ STATIC_URL }}themes/bootstrap/js/bootstrap.min.js"></script>
<script src="{{ STATIC_URL }}themes/bootstrap/js/base.js"></script>
{% endblock javascript %}
</body>
</html>

View file

@ -105,12 +105,16 @@
{% block filters %}
{% if list_filter %}
<div id="list_filter_container" class="well span4">
<h4>{# Translators : action verb #}{% trans "Filter" %}</h4>
{{ list_filter.form.as_p }}
{% if list_filter %}
<h4>{# Translators : action verb #}{% trans "Filter" %}</h4>
<form id='filter_form'>
{{ list_filter.form.as_p }}
</form>
{% else %}
<a href='./'>Reset Filter</a>
{% endif %}
</div>
{% endif %}
{% endblock filters %}
</div>

View file

@ -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):