diff options
Diffstat (limited to 'docs/topics/writable-nested-serializers.md')
| -rw-r--r-- | docs/topics/writable-nested-serializers.md | 12 | 
1 files changed, 6 insertions, 6 deletions
| diff --git a/docs/topics/writable-nested-serializers.md b/docs/topics/writable-nested-serializers.md index 66ea7815..ed614bd2 100644 --- a/docs/topics/writable-nested-serializers.md +++ b/docs/topics/writable-nested-serializers.md @@ -6,9 +6,9 @@  Although flat data structures serve to properly delineate between the individual entities in your service, there are cases where it may be more appropriate or convenient to use nested data structures. -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 dependancies between the various model instances, and the need to save or delete multiple instances in a single action. +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 | 
