1
0
mirror of https://github.com/django/django.git synced 2025-07-18 16:49:13 +00:00

[1.0.X] Fixed #11278 -- Clarified query documentation regarding bulk assignment of m2m values. Thanks to zgoda for the patch.

Merge of r11045 and r11054 from trunk.

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@11057 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Russell Keith-Magee 2009-06-18 14:14:21 +00:00
parent 58e4a9d938
commit 9029db7b79

View File

@ -880,11 +880,15 @@ in the :ref:`related objects reference <ref-models-relations>`.
Removes all objects from the related object set.
To assign the members of a related set in one fell swoop, just assign to it
from any iterable object. Example::
from any iterable object. The iterable can contain object instances, or just
a list of primary key values. For example::
b = Blog.objects.get(id=1)
b.entry_set = [e1, e2]
In this example, ``e1`` and ``e2`` can be full Entry instances, or integer
primary key values.
If the ``clear()`` method is available, any pre-existing objects will be
removed from the ``entry_set`` before all objects in the iterable (in this
case, a list) are added to the set. If the ``clear()`` method is *not*