Keep check for nested dict or list to catch issue with serializer using multiple fields with the same root source.

This commit is contained in:
Phil Richman 2017-06-13 15:22:10 +01:00
parent ea1bdc9ef8
commit 677acd36f7

View File

@ -802,7 +802,8 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
# address = serializer.CharField('profile.address')
assert not any(
len(field.source_attrs) > 1 and
(field.source_attrs[0] in validated_data)
(field.source_attrs[0] in validated_data) and
isinstance(validated_data[field.source_attrs[0]], (list, dict))
for key, field in serializer.fields.items()
), (
'The `.{method_name}()` method does not support writable dotted-source '