Code

Ticket #18996: 18996-3.diff

File 18996-3.diff, 1.2 KB (added by timo, 19 months ago)

Minor tweaks to last patch

Line 
1diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
2index f29cc28..0b7c9d3 100644
3--- a/docs/topics/db/models.txt
4+++ b/docs/topics/db/models.txt
5@@ -762,7 +762,7 @@ built-in model methods, adding new arguments. If you use ``*args,
6 **kwargs`` in your method definitions, you are guaranteed that your
7 code will automatically support those arguments when they are added.
8 
9-.. admonition:: Overriding Delete
10+.. admonition:: Overridden model methods are not called on bulk operations
11 
12     Note that the :meth:`~Model.delete()` method for an object is not
13     necessarily called when :ref:`deleting objects in bulk using a
14@@ -770,6 +770,13 @@ code will automatically support those arguments when they are added.
15     gets executed, you can use :data:`~django.db.models.signals.pre_delete`
16     and/or :data:`~django.db.models.signals.post_delete` signals.
17 
18+    Unfortunately, there isn't a workaround when
19+    :meth:`creating<django.db.models.query.QuerySet.bulk_create>` or
20+    :meth:`updating<django.db.models.query.QuerySet.update>` objects in bulk,
21+    since none of :meth:`~Model.save()`,
22+    :data:`~django.db.models.signals.pre_save`, and
23+    :data:`~django.db.models.signals.post_save` are called.
24+
25 Executing custom SQL
26 --------------------
27