diff options
| author | Tom Christie | 2014-12-18 11:21:25 +0000 |
|---|---|---|
| committer | Tom Christie | 2014-12-18 11:21:25 +0000 |
| commit | c8d88c8c8a594e3b66547a34462db4766292ea9e (patch) | |
| tree | 09d1e53c9c019501b85ff8892dca4177c95a6e0b /docs/tutorial/1-serialization.md | |
| parent | 47fe6977077ae33dfe2f8b6d04d81083b9b9f4d7 (diff) | |
| parent | d8803a35bd2dc8cbf4c892f68b48c72f24e83916 (diff) | |
| download | django-rest-framework-c8d88c8c8a594e3b66547a34462db4766292ea9e.tar.bz2 | |
Merge branch 'master' into version-3.1
Diffstat (limited to 'docs/tutorial/1-serialization.md')
| -rw-r--r-- | docs/tutorial/1-serialization.md | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index dea43cc0..ff507a2b 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -161,9 +161,7 @@ At this point we've translated the model instance into Python native datatypes. Deserialization is similar. First we parse a stream into Python native datatypes... - # This import will use either `StringIO.StringIO` or `io.BytesIO` - # as appropriate, depending on if we're running Python 2 or Python 3. - from rest_framework.compat import BytesIO + from django.utils.six import BytesIO stream = BytesIO(content) data = JSONParser().parse(stream) @@ -200,7 +198,7 @@ Open the file `snippets/serializers.py` again, and edit the `SnippetSerializer` model = Snippet fields = ('id', 'title', 'code', 'linenos', 'language', 'style') -One nice property that serializers have is that you can inspect all the fields in a serializer instance, by printing it's representation. Open the Django shell with `python manange.py shell`, then try the following: +One nice property that serializers have is that you can inspect all the fields in a serializer instance, by printing it's representation. Open the Django shell with `python manage.py shell`, then try the following: >>> from snippets.serializers import SnippetSerializer >>> serializer = SnippetSerializer() |
