mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 19:43:59 +03:00
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:
parent
1b53e804ee
commit
2946251c91
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user