aboutsummaryrefslogtreecommitdiffstats
path: root/docs/topics/writable-nested-serializers.md
diff options
context:
space:
mode:
authorCarlton Gibson2014-12-01 11:22:39 +0100
committerCarlton Gibson2014-12-01 11:22:39 +0100
commitef26f43de4a0c9ac3081c06a383b5d3d4d007797 (patch)
treebf6abcd15f0e58f4fa79a83cd4e051b8987dd311 /docs/topics/writable-nested-serializers.md
parentc50a42bddc66e28d624cd3caadd2d63502ac2e6e (diff)
parent72c4ec4e189796e506655e275cd9c77abe98e1b9 (diff)
downloaddjango-rest-framework-ef26f43de4a0c9ac3081c06a383b5d3d4d007797.tar.bz2
Merge branch 'master' of github.com:tomchristie/django-rest-framework
Diffstat (limited to 'docs/topics/writable-nested-serializers.md')
-rw-r--r--docs/topics/writable-nested-serializers.md10
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