Commit dae5426e by koliber

Changed formatting and updated docs

parent 2946251c
...@@ -747,6 +747,8 @@ To support multiple updates you'll need to do so explicitly. When writing your m ...@@ -747,6 +747,8 @@ To support multiple updates you'll need to do so explicitly. When writing your m
* How should insertions be handled? Are they invalid, or do they create new objects? * How should insertions be handled? Are they invalid, or do they create new objects?
* How should removals be handled? Do they imply object deletion, or removing a relationship? Should they be silently ignored, or are they invalid? * How should removals be handled? Do they imply object deletion, or removing a relationship? Should they be silently ignored, or are they invalid?
* How should ordering be handled? Does changing the position of two items imply any state change or is it ignored? * How should ordering be handled? Does changing the position of two items imply any state change or is it ignored?
You will need to add an explicit `id` field to the instance serializer. The default implicitly-generated `id` field is marked as `read_only`. This causes it to be removed on updates. Once you declare it explicitly, it will be available in the list serializer's `update` method.
Here's an example of how you might choose to implement multiple updates: Here's an example of how you might choose to implement multiple updates:
...@@ -774,10 +776,7 @@ Here's an example of how you might choose to implement multiple updates: ...@@ -774,10 +776,7 @@ Here's an example of how you might choose to implement multiple updates:
class BookSerializer(serializers.Serializer): class BookSerializer(serializers.Serializer):
... ...
id = serializers.IntegerField( id = serializers.IntegerField(required=False)
read_only=False,
required=False
)
class Meta: class Meta:
list_serializer_class = BookListSerializer list_serializer_class = BookListSerializer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment