Create an API to update and delete multiple objects in a single call
|Reported by:||Owned by:||Adrian Holovaty|
|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:5 Changed 11 years ago by
|Summary:||Fetch parameter to get_list and get_object, which would point whether select objects → Create an API to update and delete multiple objects in a single call|