mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #25550 -- Deprecated direct assignment to the reverse side of a related set.
This commit is contained in:
@@ -269,6 +269,21 @@ Miscellaneous
|
||||
Features deprecated in 1.10
|
||||
===========================
|
||||
|
||||
Direct assignment to a reverse foreign key or many-to-many relation
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Instead of assigning related objects using direct assignment::
|
||||
|
||||
>>> new_list = [obj1, obj2, obj3]
|
||||
>>> e.related_set = new_list
|
||||
|
||||
Use the :meth:`~django.db.models.fields.related.RelatedManager.set` method
|
||||
added in Django 1.9::
|
||||
|
||||
>>> e.related_set.set([obj1, obj2, obj3])
|
||||
|
||||
This prevents confusion about an assignment resulting in an implicit save.
|
||||
|
||||
Miscellaneous
|
||||
~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user