diff options
| author | Michael Marvick | 2015-01-25 23:45:56 -0800 | 
|---|---|---|
| committer | Michael Marvick | 2015-01-25 23:45:56 -0800 | 
| commit | 90c9968a70e0a3d14cf4433cd356bcbdd30fce1b (patch) | |
| tree | 5d89fc658a22292c23162becb4bf93e55f9c85dc /docs | |
| parent | 221a28ff92e20e596941118631f6a4a6a63cac9b (diff) | |
| download | django-rest-framework-90c9968a70e0a3d14cf4433cd356bcbdd30fce1b.tar.bz2 | |
tutorial #1 incorrectly showed string of json instead of ReturnDict type from 'serializer.data', and also has a third item in the second usage
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/tutorial/1-serialization.md | 5 | 
1 files changed, 3 insertions, 2 deletions
| diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 80e869ea..458161d0 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -151,7 +151,7 @@ We've now got a few snippet instances to play with.  Let's take a look at serial      serializer = SnippetSerializer(snippet)      serializer.data -    # {'pk': 2, 'title': u'', 'code': u'print "hello, world"\n', 'linenos': False, 'language': u'python', 'style': u'friendly'} +    # ReturnDict([('pk', 2), ('title', u''), ('code', u'print "hello, world"\n'), ('linenos', False), ('language', 'python'), ('style', 'friendly')])  At this point we've translated the model instance into Python native datatypes.  To finalize the serialization process we render the data into `json`. @@ -182,7 +182,8 @@ We can also serialize querysets instead of model instances.  To do so we simply      serializer = SnippetSerializer(Snippet.objects.all(), many=True)      serializer.data -    # [{'pk': 1, 'title': u'', 'code': u'foo = "bar"\n', 'linenos': False, 'language': u'python', 'style': u'friendly'}, {'pk': 2, 'title': u'', 'code': u'print "hello, world"\n', 'linenos': False, 'language': u'python', 'style': u'friendly'}] +    # [OrderedDict([('pk', 1), ('title', u''), ('code', u'foo = "bar"\n'), ('linenos', False), ('language', 'python'), ('style', 'friendly')]), OrderedDict([('pk', 2), ('title', u''), ('code', u'print "hello, world"\n'), ('linenos', False), ('language', 'python'), ('style', 'friendly')]), OrderedDict([('pk', 3), ('title', u''), ('code', u'print "hello, world"\n'), ('linenos', False), ('language', 'python'), ('style', 'friendly')])] +  ## Using ModelSerializers | 
