mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
added comment why m2m fields are saved after instance
This commit is contained in:
parent
177949472c
commit
4871372e24
|
@ -982,6 +982,9 @@ class ModelSerializer(Serializer):
|
|||
|
||||
instance.save()
|
||||
|
||||
# Note that many-to-many fields are set after updating instance.
|
||||
# Setting m2m fields triggers signals which could potentialy change
|
||||
# updated instance and we do not want it to collide with .update()
|
||||
for attr, value in m2m_fields:
|
||||
field = getattr(instance, attr)
|
||||
field.set(value)
|
||||
|
|
Loading…
Reference in New Issue
Block a user