From 623304a19dbbb7bfe67b865edbaf47205bdba429 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 18 Aug 2014 11:10:41 +0100 Subject: Latest docs deploy --- tutorial/1-serialization.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tutorial/1-serialization.html') diff --git a/tutorial/1-serialization.html b/tutorial/1-serialization.html index fba132f1..53401303 100644 --- a/tutorial/1-serialization.html +++ b/tutorial/1-serialization.html @@ -356,7 +356,7 @@ serializer.data content # '{"pk": 2, "title": "", "code": "print \\"hello, world\\"\\n", "linenos": false, "language": "python", "style": "friendly"}' -

Deserialization is similar. First we parse a stream 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
@@ -427,7 +427,7 @@ def snippet_list(request):
             return JSONResponse(serializer.data, status=201)
         return JSONResponse(serializer.errors, status=400)
 
-

Note that because we want to be able to POST to this view from clients that won't have a CSRF token we need to mark the view as csrf_exempt. This isn't something that you'd normally want to do, and REST framework views actually use more sensible behavior than this, but it'll do for our purposes right now.

+

Note that because we want to be able to POST to this view from clients that won't have a CSRF token we need to mark the view as csrf_exempt. This isn't something that you'd normally want to do, and REST framework views actually use more sensible behavior than this, but it'll do for our purposes right now.

We'll also need a view which corresponds to an individual snippet, and can be used to retrieve, update or delete the snippet.

@csrf_exempt
 def snippet_detail(request, pk):
-- 
cgit v1.2.3