mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-08 06:14:47 +03:00
Merge 8bfe0423d3
into 9b56dda918
This commit is contained in:
commit
261ed2de16
|
@ -880,7 +880,16 @@ class ModelSerializer(Serializer):
|
|||
# relationships as being a special case. During updates we already
|
||||
# have an instance pk for the relationships to be associated with.
|
||||
for attr, value in validated_data.items():
|
||||
if isinstance(value, dict):
|
||||
instance_attr = getattr(instance, attr)
|
||||
for _attr, _value in value.items():
|
||||
setattr(instance_attr, _attr, _value)
|
||||
|
||||
instance_attr.save()
|
||||
setattr(instance, attr, instance_attr)
|
||||
else:
|
||||
setattr(instance, attr, value)
|
||||
|
||||
instance.save()
|
||||
|
||||
return instance
|
||||
|
|
Loading…
Reference in New Issue
Block a user