Opened 9 years ago

Closed 6 years ago

#2383 closed enhancement (fixed)

[patch] delete multiple items at once

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

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@… 9 years ago.
tooltag-delete_over.gif (343 bytes) - added by jay@… 9 years ago.
tooltag-delete.gif (339 bytes) - added by jay@… 9 years ago.
delete.js (73 bytes) - added by jay@… 9 years ago.
new_multi_delete.diff (9.7 KB) - added by jay@… 9 years ago.
deletelist.patch (9.4 KB) - added by atlithorn 9 years ago.
updated patch, based on jay's patch
deletelist_confirmation.html (1.5 KB) - added by atlithorn 9 years ago.
template to allow for confirmation of deletion
deletelist_with_templates_updated.diff (10.9 KB) - added by deryck <deryck@…> 8 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)

Changed 9 years ago by jay@…

Changed 9 years ago by jay@…

Changed 9 years ago by jay@…

comment:1 Changed 9 years ago by atlithorn

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.

Changed 9 years ago by jay@…

Changed 9 years ago by jay@…

comment:2 Changed 9 years ago by jay@…

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 Changed 9 years ago by jay@…

  • Version set to SVN

updating the version

comment:4 Changed 9 years ago by atlithorn

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()"

Changed 9 years ago by atlithorn

updated patch, based on jay's patch

Changed 9 years ago by atlithorn

template to allow for confirmation of deletion

comment:5 Changed 8 years ago by deryck <deryck@…>

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.

Changed 8 years ago by deryck <deryck@…>

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

comment:6 Changed 8 years ago by SmileyChris

  • Triage Stage changed from Unreviewed to Design 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 Changed 7 years ago by Øyvind Saltvik <oyvind@…>

  • Resolution set to wontfix
  • Status changed from new to closed

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

comment:8 Changed 7 years ago by ubernostrum

  • Resolution wontfix deleted
  • Status changed from closed to reopened

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

comment:9 Changed 7 years ago by jacob

  • Triage Stage changed from Design decision needed to Someday/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 Changed 7 years ago by jakub_vysoky

  • Keywords nfa-changelist added

comment:11 Changed 6 years ago by anonymous

  • Keywords djangocon added

comment:12 Changed 6 years ago by ericholscher

  • Keywords nfa-changelist removed
  • Needs documentation set
  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Someday/Maybe to Accepted

comment:13 Changed 6 years ago by bryanveloso

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

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

comment:14 Changed 6 years ago by ericholscher

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in r10121, allowing bulk actions in the admin.

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