Browse files

[1.4.x] Fixed #18996 - Clarified overriden model methods not called o…

…n bulk operations

Backport of 443999a from master.
  • Loading branch information...
timgraham committed Oct 12, 2012
1 parent e2dea54 commit d2891d1c0751d53c10f19672ac7d232b6e5088b0
Showing with 8 additions and 1 deletion.
  1. +8 −1 docs/topics/db/models.txt
@@ -761,14 +761,21 @@ built-in model methods, adding new arguments. If you use ``*args,
**kwargs`` in your method definitions, you are guaranteed that your
code will automatically support those arguments when they are added.
.. admonition:: Overriding Delete
.. admonition:: Overridden model methods are not called on bulk operations
Note that the :meth:`~Model.delete()` method for an object is not
necessarily called when :ref:`deleting objects in bulk using a
QuerySet<topics-db-queries-delete>`. To ensure customized 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
:meth:`creating<django.db.models.query.QuerySet.bulk_create>` or
:meth:`updating<django.db.models.query.QuerySet.update>` objects in bulk,
since none of :meth:``,
:data:`~django.db.models.signals.pre_save`, and
:data:`~django.db.models.signals.post_save` are called.
Executing custom SQL

0 comments on commit d2891d1

Please sign in to comment.