#1219 closed defect (fixed)
There's no way to bulk delete a set of objects
Reported by: | jacobkm | Owned by: | Russell Keith-Magee |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | |
Severity: | normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Ned Batchelder wrote to django-users:
> I'm used to writing SQL statements like: > > delete from app_things where type = 'foo'; > > to delete a number of objects at once. I don't see a way to do this > type of delete in Django. I was hoping for something like: > > things.delete(type__exact='foo') > > Certainly I could do this: > > for t in things.get_list(type__exact='foo'): > t.delete() > > but this incurs a lot more database activity.
Attachments (2)
Change History (10)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 19 years ago
comment:4 by , 19 years ago
Reporter: | changed from | to
---|---|
Resolution: | fixed |
Status: | closed → reopened |
I reopen this ticket because of the different behaviour of bulk delete and object delete with regard to related objects and relation tables for ManyToMany. See this discussion in django-users.
comment:5 by , 19 years ago
Owner: | changed from | to
---|---|
Reporter: | changed from | to
Status: | reopened → new |
comment:6 by , 19 years ago
Owner: | changed from | to
---|
by , 19 years ago
Attachment: | bulk-delete.patch added |
---|
Patch implementing bulk delete in post-descriptor magic-removal
by , 19 years ago
Attachment: | bulk-delete-v2.patch added |
---|
Patch implementing bulk delete in post-descriptor magic-removal
comment:7 by , 19 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Here's a patch against magic-removal that adds bulk delete to the Manager for a model class. Is this approach going to get obsoleted by the descriptor work?