mirror of
https://github.com/django/django.git
synced 2025-09-26 12:09:19 +00:00
Fixed #18676 -- Allow fast-path deletion of objects
Objects can be fast-path deleted if there are no signals, and there are no further cascades. If fast-path is taken, the objects do not need to be loaded into memory before deletion. Thanks to Jeremy Dunck, Simon Charette and Alex Gaynor for reviewing the patch.
This commit is contained in:
parent
3fcca0e947
commit
1cd6e04cd4
13 changed files with 275 additions and 19 deletions
|
@ -529,6 +529,14 @@ class QuerySet(object):
|
|||
self._result_cache = None
|
||||
delete.alters_data = True
|
||||
|
||||
def _raw_delete(self, using):
|
||||
"""
|
||||
Deletes objects found from the given queryset in single direct SQL
|
||||
query. No signals are sent, and there is no protection for cascades.
|
||||
"""
|
||||
sql.DeleteQuery(self.model).delete_qs(self, using)
|
||||
_raw_delete.alters_data = True
|
||||
|
||||
def update(self, **kwargs):
|
||||
"""
|
||||
Updates all elements in the current QuerySet, setting all the given
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue