mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
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.
This commit is contained in:
parent
eb78da4b54
commit
0e42c2e663
|
@ -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 '
|
||||
|
|
Loading…
Reference in New Issue
Block a user