mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
reverted condition
This commit is contained in:
parent
9942453e31
commit
064f1e9a14
|
@ -975,7 +975,9 @@ class ModelSerializer(Serializer):
|
||||||
# have an instance pk for the relationships to be associated with.
|
# have an instance pk for the relationships to be associated with.
|
||||||
m2m_fields = []
|
m2m_fields = []
|
||||||
for attr, value in validated_data.items():
|
for attr, value in validated_data.items():
|
||||||
if attr not in info.relations or not info.relations[attr].to_many:
|
if attr in info.relations and info.relations[attr].to_many:
|
||||||
|
m2m_fields.append((attr, value))
|
||||||
|
else:
|
||||||
setattr(instance, attr, value)
|
setattr(instance, attr, value)
|
||||||
else:
|
else:
|
||||||
m2m_fields.append((attr, value))
|
m2m_fields.append((attr, value))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user