Clarified that Model.delete() isn't called as a result of a cascading delete.

This commit is contained in:
David Sanders 2015-09-29 12:09:57 +10:00 committed by Tim Graham
parent b47552b445
commit 5c6316dc34
1 changed files with 5 additions and 3 deletions

View File

@ -835,9 +835,11 @@ code will automatically support those arguments when they are added.
Note that the :meth:`~Model.delete()` method for an object is not Note that the :meth:`~Model.delete()` method for an object is not
necessarily called when :ref:`deleting objects in bulk using a necessarily called when :ref:`deleting objects in bulk using a
QuerySet<topics-db-queries-delete>`. To ensure customized delete logic QuerySet <topics-db-queries-delete>` or as a result of a :attr:`cascading
gets executed, you can use :data:`~django.db.models.signals.pre_delete` delete <django.db.models.ForeignKey.on_delete>`. To ensure customized
and/or :data:`~django.db.models.signals.post_delete` signals. delete logic gets executed, you can use
:data:`~django.db.models.signals.pre_delete` and/or
:data:`~django.db.models.signals.post_delete` signals.
Unfortunately, there isn't a workaround when Unfortunately, there isn't a workaround when
:meth:`creating<django.db.models.query.QuerySet.bulk_create>` or :meth:`creating<django.db.models.query.QuerySet.bulk_create>` or