diff options
| author | Loic Bistuer <loic.bistuer@gmail.com> | 2015-01-30 01:15:27 +0700 |
|---|---|---|
| committer | Loic Bistuer <loic.bistuer@gmail.com> | 2015-02-05 12:45:08 +0700 |
| commit | 71ada3a8e689a883b5ffdeb1744ea16f176ab730 (patch) | |
| tree | 7e4696ec75370e0747a26c4dea541626573895b2 /docs/releases | |
| parent | 49516f7158ed0ca39ea8116d25a32a80288d47b3 (diff) | |
Fixed #6707 -- Added RelatedManager.set() and made descriptors' __set__ use it.
Thanks Anssi Kääriäinen, Carl Meyer, Collin Anderson, and Tim Graham for the reviews.
Diffstat (limited to 'docs/releases')
| -rw-r--r-- | docs/releases/1.9.txt | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/docs/releases/1.9.txt b/docs/releases/1.9.txt index eee63c6f6d..d00bfef096 100644 --- a/docs/releases/1.9.txt +++ b/docs/releases/1.9.txt @@ -127,7 +127,10 @@ Management Commands Models ^^^^^^ -* ... +* Added the :meth:`RelatedManager.set() + <django.db.models.fields.related.RelatedManager.set()>` method to the related + managers created by ``ForeignKey``, ``GenericForeignKey``, and + ``ManyToManyField``. Signals ^^^^^^^ @@ -192,6 +195,25 @@ used by the egg loader to detect if setuptools was installed. The ``is_usable`` attribute is now removed and the egg loader instead fails at runtime if setuptools is not installed. +Related set direct assignment +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +:ref:`Direct assignment <direct-assignment>`) used to perform a ``clear()`` +followed by a call to ``add()``. This caused needlessly large data changes +and prevented using the :data:`~django.db.models.signals.m2m_changed` signal +to track individual changes in many-to-many relations. + +Direct assignment now relies on the the new +:meth:`django.db.models.fields.related.RelatedManager.set()` method on +related managers which by default only processes changes between the +existing related set and the one that's newly assigned. The previous behavior +can be restored by replacing direct assignment by a call to ``set()`` with +the keyword argument ``clear=True``. + +``ModelForm``, and therefore ``ModelAdmin``, internally rely on direct +assignment for many-to-many relations and as a consequence now use the new +behavior. + Miscellaneous ~~~~~~~~~~~~~ |
