From f450bc9f44bc1270eae911daa157c155c29d1d9d Mon Sep 17 00:00:00 2001 From: Loic Bistuer Date: Fri, 22 Nov 2013 00:14:16 +0700 Subject: Added a bulk option to RelatedManager remove() and clear() methods Refs #21169 --- docs/ref/models/relations.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'docs/ref') diff --git a/docs/ref/models/relations.txt b/docs/ref/models/relations.txt index 2fca954676..0c47bc4047 100644 --- a/docs/ref/models/relations.txt +++ b/docs/ref/models/relations.txt @@ -110,6 +110,17 @@ Related objects reference the ``blog`` :class:`~django.db.models.ForeignKey` doesn't have ``null=True``, this is invalid. + .. versionchanged 1.7:: + + For :class:`~django.db.models.ForeignKey` objects, this method accepts + a ``bulk`` argument to control how to perform the operation. + If ``True`` (the default), ``QuerySet.update()`` is used. + If ``bulk=False``, the ``save()`` method of each individual model + instance is called instead. This triggers the + :data:`~django.db.models.signals.pre_save` and + :data:`~django.db.models.signals.post_save` signals and comes at the + expense of performance. + .. method:: clear() Removes all objects from the related object set:: @@ -121,7 +132,8 @@ Related objects reference them. Just like ``remove()``, ``clear()`` is only available on - :class:`~django.db.models.ForeignKey`\s where ``null=True``. + :class:`~django.db.models.ForeignKey`\s where ``null=True`` and it also + accepts the ``bulk`` keyword argument. .. note:: -- cgit v1.3