Create an API to update and delete multiple objects in a single call
|Reported by:||Maurycy Pawłowski-Wieroński <maurycypw@…>||Owned by:||adrian|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Many times you need to delete or update one or many objects, without retreving them first.
My proposal is to add fetch parameter to get_list and get_object methods, which would point whether send select query or create empty models with only specified fields, for further operations, like delete or update.
# No SQL queries, since fetch=False is set. choices are empty and have only poll_id field. choices = choices.get_list(poll__exact=1, fetch=False) # Now call: DELETE FROM poll_choices WHERE poll_id = 1 choices.delete()
See also #433.
Change History (7)
comment:1 Changed 10 years ago by Maurycy Pawłowski-Wieroński <maurycypw@…>
- Type changed from defect to enhancement
comment:5 Changed 9 years ago by adrian
- Summary changed from Fetch parameter to get_list and get_object, which would point whether select objects to Create an API to update and delete multiple objects in a single call