Django admin inline: select all for delete? -


in django admin inline forms, there checkboxes deleting individual inline objects. there way enable selecting of them @ once deletion?

here's solution worked out:

in templates/admin/edit_inline/tabular.html

{% if inline_admin_formset.formset.can_delete %}<th>{% trans "delete?" %}&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" class="selectall_checkbox"/></th>{% endif %} 

and

<script type="text/javascript"> $('.selectall_checkbox').click(function(e) {     $(e.target).closest('table').find(':checkbox').filter(function () { return /delete/.test(this.name); }).each(function () {           this.checked = e.target.checked;     }); }); </script> 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -