mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-10 00:21:01 +03:00
Minor tweaks
This commit is contained in:
parent
ca74fa989d
commit
88900a0844
|
@ -589,8 +589,8 @@ def raise_errors_on_nested_writes(method_name, serializer):
|
||||||
isinstance(field, BaseSerializer) and (key in validated_attrs)
|
isinstance(field, BaseSerializer) and (key in validated_attrs)
|
||||||
for key, field in serializer.fields.items()
|
for key, field in serializer.fields.items()
|
||||||
), (
|
), (
|
||||||
'The `.{method_name}()` method does not support nested writable '
|
'The `.{method_name}()` method does not support writable nested'
|
||||||
'fields by default. Write an explicit `.{method_name}()` method for '
|
'fields by default.\nWrite an explicit `.{method_name}()` method for '
|
||||||
'serializer `{module}.{class_name}`, or set `read_only=True` on '
|
'serializer `{module}.{class_name}`, or set `read_only=True` on '
|
||||||
'nested serializer fields.'.format(
|
'nested serializer fields.'.format(
|
||||||
method_name=method_name,
|
method_name=method_name,
|
||||||
|
@ -609,7 +609,7 @@ def raise_errors_on_nested_writes(method_name, serializer):
|
||||||
for key, field in serializer.fields.items()
|
for key, field in serializer.fields.items()
|
||||||
), (
|
), (
|
||||||
'The `.{method_name}()` method does not support writable dotted-source '
|
'The `.{method_name}()` method does not support writable dotted-source '
|
||||||
'fields by default. Write an explicit `.{method_name}()` method for '
|
'fields by default.\nWrite an explicit `.{method_name}()` method for '
|
||||||
'serializer `{module}.{class_name}`, or set `read_only=True` on '
|
'serializer `{module}.{class_name}`, or set `read_only=True` on '
|
||||||
'dotted-source serializer fields.'.format(
|
'dotted-source serializer fields.'.format(
|
||||||
method_name=method_name,
|
method_name=method_name,
|
||||||
|
@ -727,6 +727,7 @@ class ModelSerializer(Serializer):
|
||||||
for attr, value in validated_data.items():
|
for attr, value in validated_data.items():
|
||||||
setattr(instance, attr, value)
|
setattr(instance, attr, value)
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def get_validators(self):
|
def get_validators(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user