Added explicit id field in multi update example

If the id field is implicitly created, it is created as `read_only=True`. This causes the data validation step to remove the id values in the validated data.
This commit is contained in:
koliber 2015-08-18 14:47:04 +02:00
parent 1b53e804ee
commit 2946251c91

View File

@ -774,6 +774,11 @@ Here's an example of how you might choose to implement multiple updates:
class BookSerializer(serializers.Serializer): class BookSerializer(serializers.Serializer):
... ...
id = serializers.IntegerField(
read_only=False,
required=False
)
class Meta: class Meta:
list_serializer_class = BookListSerializer list_serializer_class = BookListSerializer