Opened 18 years ago

Closed 15 years ago

#2383 closed enhancement (fixed)

[patch] delete multiple items at once

Reported by: jay@… Owned by: nobody
Component: contrib.admin Version: dev
Severity: normal Keywords: djangocon
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

In response to http://www2.jeffcroft.com/2006/jul/20/top-ten-things-suck-about-django/ #3 Admin interface: inability to delete multiple items at once.

I came up with this patch because I had the same need. I had a few thoughts of how to implement this, but I went with this way because it seemed to follow the way the Django admin works.

Feedback is appreciated.

Attachments (8)

multi_delete.diff (9.6 KB ) - added by jay@… 18 years ago.
tooltag-delete_over.gif (343 bytes ) - added by jay@… 18 years ago.
tooltag-delete.gif (339 bytes ) - added by jay@… 18 years ago.
delete.js (73 bytes ) - added by jay@… 18 years ago.
new_multi_delete.diff (9.7 KB ) - added by jay@… 18 years ago.
deletelist.patch (9.4 KB ) - added by atlithorn 18 years ago.
updated patch, based on jay's patch
deletelist_confirmation.html (1.5 KB ) - added by atlithorn 18 years ago.
template to allow for confirmation of deletion
deletelist_with_templates_updated.diff (10.9 KB ) - added by deryck <deryck@…> 17 years ago.
New patch, fixing "has_delete_permissions" and doing a proper form POST submit (sans JavaScript)

Download all attachments as: .zip

Change History (22)

by jay@…, 18 years ago

Attachment: multi_delete.diff added

by jay@…, 18 years ago

Attachment: tooltag-delete_over.gif added

by jay@…, 18 years ago

Attachment: tooltag-delete.gif added

comment:1 by atlithorn, 18 years ago

I guess you need to attach delete.js as well for the patch to work? I wrote a patch for this a couple of weeks ago as well but I don't want to make this more difficult than necessary, if yours works then we'll just dump ours for yours.

by jay@…, 18 years ago

Attachment: delete.js added

by jay@…, 18 years ago

Attachment: new_multi_delete.diff added

comment:2 by jay@…, 18 years ago

I updated this patch to work with people who are superusers. Before only people that had explicit permisions got the delete box.

Also Trac would not let me override the diff file, so I renamed it new_multi_delete.diff

Jay Graves

comment:3 by jay@…, 18 years ago

Version: SVN

updating the version

comment:4 by atlithorn, 18 years ago

Looks good, I would like to see the deletion go through an "Are you sure" step just like the normal delete_stage process. Also I was unable to delete objects that had primary keys based on something other than the auto_increment id. I'm including a patch based on your patch.

It needs the accompanying deletelist_confirmation.html.
I also replaced the need for delete.js with the following change to the delete anchor:
... onclick="document.getElementById('delete_form_checked').submit()"

by atlithorn, 18 years ago

Attachment: deletelist.patch added

updated patch, based on jay's patch

by atlithorn, 18 years ago

template to allow for confirmation of deletion

comment:5 by deryck <deryck@…>, 17 years ago

I'm interested in this functionality, too. Though, there are a couple things about the patches.

User's "has_delete_permissions" wasn't being set correctly. The patch I'm including fixes this. Also, I think this should be done by a regular form POST, not with the JavaScript onsubmit handler. The updated patch does this now.

Some warts still: Using the form submit, the "Delete checked" button falls at the bottom of the page, which on long pages may not be good. Maybe this doesn't matter. Also, I'm not sure if the "Delete?" check box should appear on every object's list page. Maybe this should be an Admin option on the model, and then, if permissions are present, the functionality appears.

Also, the patch I'm attaching includes the template changes inline with the rest of the code.

by deryck <deryck@…>, 17 years ago

New patch, fixing "has_delete_permissions" and doing a proper form POST submit (sans JavaScript)

comment:6 by Chris Beaven, 17 years ago

Triage Stage: UnreviewedDesign decision needed

Looks really good! There's still some decisions to make but I'm pretty sure this will get accepted. Good work Jay, atlithorn and deryck.

comment:7 by Øyvind Saltvik <oyvind@…>, 17 years ago

Resolution: wontfix
Status: newclosed

Closed as wontfix, repoen if patch works against newforms-admin.

comment:8 by James Bennett, 17 years ago

Resolution: wontfix
Status: closedreopened

Please don't do that; feature requests that are worth considering for newforms-admin should remain open until newforms-admin is done.

comment:9 by Jacob, 16 years ago

Triage Stage: Design decision neededSomeday/Maybe

At some point in the future we're going to revisit the design/behavior of the admin, and this will certainly be part of that process. However, we're not in a hurry to add bits on piecemeal since that could lead to crufty UI.

comment:10 by jakub_vysoky, 16 years ago

Keywords: nfa-changelist added

comment:11 by anonymous, 16 years ago

Keywords: djangocon added

comment:12 by Eric Holscher, 16 years ago

Keywords: nfa-changelist removed
Needs documentation: set
Needs tests: set
Patch needs improvement: set
Triage Stage: Someday/MaybeAccepted

comment:13 by Bryan Veloso, 16 years ago

http://code.google.com/p/django-batchadmin/

Just adding this here since it is definitely relevant and nicely designed.

comment:14 by Eric Holscher, 15 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in r10121, allowing bulk actions in the admin.

Note: See TracTickets for help on using tickets.
Back to Top