Skip to content

Commit 6158285

Browse files
committed
Merge pull request #2266 from tomchristie/improve-nested-write-checking
Improve error checking for nested writes.
2 parents eb78da4 + c0b9115 commit 6158285

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

rest_framework/serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,7 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
611611
# profile = ProfileSerializer()
612612
assert not any(
613613
isinstance(field, BaseSerializer) and (key in validated_data)
614+
and isinstance(validated_data[key], (list, dict))
614615
for key, field in serializer.fields.items()
615616
), (
616617
'The `.{method_name}()` method does not support writable nested'
@@ -630,6 +631,7 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
630631
# address = serializer.CharField('profile.address')
631632
assert not any(
632633
'.' in field.source and (key in validated_data)
634+
and isinstance(validated_data[key], (list, dict))
633635
for key, field in serializer.fields.items()
634636
), (
635637
'The `.{method_name}()` method does not support writable dotted-source '

0 commit comments

Comments
 (0)