Improve check for nested writes

This commit is contained in:
Tom Christie 2014-12-13 14:17:24 +00:00
parent eb78da4b54
commit c0b9115bec

View File

@ -611,6 +611,7 @@ 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))
for key, field in serializer.fields.items()
), (
'The `.{method_name}()` method does not support writable nested'
@ -630,6 +631,7 @@ def raise_errors_on_nested_writes(method_name, serializer, validated_data):
# address = serializer.CharField('profile.address')
assert not any(
'.' in field.source and (key in validated_data)
and isinstance(validated_data[key], (list, dict))
for key, field in serializer.fields.items()
), (
'The `.{method_name}()` method does not support writable dotted-source '