Commit 88c6c380 by Tom Christie Committed by GitHub

Use field.source to perform check for writable nested field, not key (#4568)

parent 2519ce91
......@@ -744,8 +744,8 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
# profile = ProfileSerializer()
assert not any(
isinstance(field, BaseSerializer) and
(key in validated_data) and
isinstance(validated_data[key], (list, dict))
(field.source in validated_data) and
isinstance(validated_data[field.source], (list, dict))
for key, field in serializer.fields.items()
), (
'The `.{method_name}()` method does not support writable nested '
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment