From 0e42c2e6637d60b864347821a84f48ebee79fd8c Mon Sep 17 00:00:00 2001 From: Ben Oswald Date: Sat, 13 Dec 2014 18:09:21 +0100 Subject: [PATCH] add read_only check for dotted-source fields in serializers The error message tells that you should create an own crate() function or set read_only=True for the field. The Problem is that the check ignores the read_only flag. --- rest_framework/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/serializers.py b/rest_framework/serializers.py index 9226895e0..87637e25b 100644 --- a/rest_framework/serializers.py +++ b/rest_framework/serializers.py @@ -629,7 +629,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) + '.' in field.source and (key in validated_data) and (field.read_only is not True) for key, field in serializer.fields.items() ), ( 'The `.{method_name}()` method does not support writable dotted-source '