diff options
| author | José Padilla | 2014-10-31 13:03:39 -0400 |
|---|---|---|
| committer | Dougal Matthews | 2014-11-25 12:44:11 +0000 |
| commit | 200e0b17daecd07de6d1f9926a430d29b3ee948f (patch) | |
| tree | 8a8ac43c96df3a46b6c59f9a15a19553c7fb0e47 /docs/topics/writable-nested-serializers.md | |
| parent | 06683b86b2b15153df52fe481b5c4eeb489a80cf (diff) | |
| download | django-rest-framework-200e0b17daecd07de6d1f9926a430d29b3ee948f.tar.bz2 | |
Clean up extra white space
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 |
