mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-06-23 06:53:16 +03:00
Use field.source to perform check for writable nested field, not key (#4568)
This commit is contained in:
parent
2519ce9128
commit
88c6c380c5
|
@ -744,8 +744,8 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
|
||||||
# profile = ProfileSerializer()
|
# profile = ProfileSerializer()
|
||||||
assert not any(
|
assert not any(
|
||||||
isinstance(field, BaseSerializer) and
|
isinstance(field, BaseSerializer) and
|
||||||
(key in validated_data) and
|
(field.source in validated_data) and
|
||||||
isinstance(validated_data[key], (list, dict))
|
isinstance(validated_data[field.source], (list, dict))
|
||||||
for key, field in serializer.fields.items()
|
for key, field in serializer.fields.items()
|
||||||
), (
|
), (
|
||||||
'The `.{method_name}()` method does not support writable nested '
|
'The `.{method_name}()` method does not support writable nested '
|
||||||
|
|
Loading…
Reference in New Issue
Block a user