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?" %} <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
Post a Comment