Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error checking for nested writes. #2266

Merged
merged 1 commit into from
Dec 13, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 '
Expand Down