mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Typos in serializers documentation (#5652)
Fixes #5651. Change `update()` to `.update()` in serializers documentation to get a consistency with `.create()`.
This commit is contained in:
parent
7855d3bd8b
commit
01587b9eb1
|
@ -73,7 +73,7 @@ Deserialization is similar. First we parse a stream into Python native datatypes
|
||||||
|
|
||||||
## Saving instances
|
## Saving instances
|
||||||
|
|
||||||
If we want to be able to return complete object instances based on the validated data we need to implement one or both of the `.create()` and `update()` methods. For example:
|
If we want to be able to return complete object instances based on the validated data we need to implement one or both of the `.create()` and `.update()` methods. For example:
|
||||||
|
|
||||||
class CommentSerializer(serializers.Serializer):
|
class CommentSerializer(serializers.Serializer):
|
||||||
email = serializers.EmailField()
|
email = serializers.EmailField()
|
||||||
|
@ -325,7 +325,7 @@ For updates you'll want to think carefully about how to handle updates to relati
|
||||||
* Ignore the data and leave the instance as it is.
|
* Ignore the data and leave the instance as it is.
|
||||||
* Raise a validation error.
|
* Raise a validation error.
|
||||||
|
|
||||||
Here's an example for an `update()` method on our previous `UserSerializer` class.
|
Here's an example for an `.update()` method on our previous `UserSerializer` class.
|
||||||
|
|
||||||
def update(self, instance, validated_data):
|
def update(self, instance, validated_data):
|
||||||
profile_data = validated_data.pop('profile')
|
profile_data = validated_data.pop('profile')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user