aboutsummaryrefslogtreecommitdiffstats
path: root/docs/tutorial
diff options
context:
space:
mode:
authorTom Christie2014-12-18 11:21:25 +0000
committerTom Christie2014-12-18 11:21:25 +0000
commitc8d88c8c8a594e3b66547a34462db4766292ea9e (patch)
tree09d1e53c9c019501b85ff8892dca4177c95a6e0b /docs/tutorial
parent47fe6977077ae33dfe2f8b6d04d81083b9b9f4d7 (diff)
parentd8803a35bd2dc8cbf4c892f68b48c72f24e83916 (diff)
downloaddjango-rest-framework-c8d88c8c8a594e3b66547a34462db4766292ea9e.tar.bz2
Merge branch 'master' into version-3.1
Diffstat (limited to 'docs/tutorial')
-rw-r--r--docs/tutorial/1-serialization.md6
-rw-r--r--docs/tutorial/4-authentication-and-permissions.md2
-rw-r--r--docs/tutorial/6-viewsets-and-routers.md4
-rw-r--r--docs/tutorial/quickstart.md2
4 files changed, 6 insertions, 8 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()
diff --git a/docs/tutorial/4-authentication-and-permissions.md b/docs/tutorial/4-authentication-and-permissions.md
index a6d27bf7..592c77e8 100644
--- a/docs/tutorial/4-authentication-and-permissions.md
+++ b/docs/tutorial/4-authentication-and-permissions.md
@@ -206,7 +206,7 @@ If we try to create a snippet without authenticating, we'll get an error:
We can make a successful request by including the username and password of one of the users we created earlier.
- http POST -a tom:password http://127.0.0.1:8000/snippets/ code="print 789"
+ http -a tom:password POST http://127.0.0.1:8000/snippets/ code="print 789"
{
"id": 5,
diff --git a/docs/tutorial/6-viewsets-and-routers.md b/docs/tutorial/6-viewsets-and-routers.md
index 816e9da6..d55a60de 100644
--- a/docs/tutorial/6-viewsets-and-routers.md
+++ b/docs/tutorial/6-viewsets-and-routers.md
@@ -44,8 +44,8 @@ Next we're going to replace the `SnippetList`, `SnippetDetail` and `SnippetHighl
snippet = self.get_object()
return Response(snippet.highlighted)
- def pre_save(self, obj):
- obj.owner = self.request.user
+ def perform_create(self, serializer):
+ serializer.save(owner=self.request.user)
This time we've used the `ModelViewSet` class in order to get the complete set of default read and write operations.
diff --git a/docs/tutorial/quickstart.md b/docs/tutorial/quickstart.md
index c3f95994..a4474c34 100644
--- a/docs/tutorial/quickstart.md
+++ b/docs/tutorial/quickstart.md
@@ -19,7 +19,7 @@ Create a new Django project named `tutorial`, then start a new app called `quick
pip install djangorestframework
# Set up a new project with a single application
- django-admin.py startproject tutorial .
+ django-admin.py startproject tutorial . # Note the trailing '.' character
cd tutorial
django-admin.py startapp quickstart
cd ..