diff options
Diffstat (limited to 'docs/topics/writable-nested-serializers.md')
| -rw-r--r-- | docs/topics/writable-nested-serializers.md | 10 | 
1 files changed, 5 insertions, 5 deletions
| diff --git a/docs/topics/writable-nested-serializers.md b/docs/topics/writable-nested-serializers.md index abc6a82f..ed614bd2 100644 --- a/docs/topics/writable-nested-serializers.md +++ b/docs/topics/writable-nested-serializers.md @@ -8,7 +8,7 @@ Although flat data structures serve to properly delineate between the individual  Nested data structures are easy enough to work with if they're read-only - simply nest your serializer classes and you're good to go.  However, there are a few more subtleties to using writable nested serializers, due to the dependencies between the various model instances, and the need to save or delete multiple instances in a single action. -## One-to-many data structures  +## One-to-many data structures  *Example of a **read-only** nested serializer.  Nothing complex to worry about here.* @@ -16,10 +16,10 @@ Nested data structures are easy enough to work with if they're read-only - simpl  	    class Meta:  	        model = ToDoItem  	        fields = ('text', 'is_completed') -	 +  	class ToDoListSerializer(serializers.ModelSerializer):  	    items = ToDoItemSerializer(many=True, read_only=True) -	 +  	    class Meta:  	        model = ToDoList  	        fields = ('title', 'items') @@ -31,7 +31,7 @@ Some example output from our serializer.          'items': {              {'text': 'Compile playlist', 'is_completed': True},              {'text': 'Send invites', 'is_completed': False}, -            {'text': 'Clean house', 'is_completed': False}             +            {'text': 'Clean house', 'is_completed': False}          }      } @@ -44,4 +44,4 @@ Let's take a look at updating our nested one-to-many data structure.  ### Making PATCH requests -[cite]: http://jsonapi.org/format/#url-based-json-api
\ No newline at end of file +[cite]: http://jsonapi.org/format/#url-based-json-api | 
