aboutsummaryrefslogtreecommitdiffstats
path: root/tutorial/1-serialization.html
diff options
context:
space:
mode:
authorTom Christie2013-12-23 12:37:56 +0000
committerTom Christie2013-12-23 12:37:56 +0000
commit66cc2d3d5d611c57638a59932cd65c62d9b130c2 (patch)
tree9856f0c766c51f45e753dd8a6c01844879c5c0b4 /tutorial/1-serialization.html
parente6fd79fd88067d830886f9c463d5b9e5c13d7ce3 (diff)
downloaddjango-rest-framework-66cc2d3d5d611c57638a59932cd65c62d9b130c2.tar.bz2
Switch title ordering.
Diffstat (limited to 'tutorial/1-serialization.html')
-rw-r--r--tutorial/1-serialization.html8
1 files changed, 3 insertions, 5 deletions
diff --git a/tutorial/1-serialization.html b/tutorial/1-serialization.html
index c75116d3..76c7f818 100644
--- a/tutorial/1-serialization.html
+++ b/tutorial/1-serialization.html
@@ -2,7 +2,7 @@
<html lang="en">
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
- <title>Django REST framework - Tutorial 1: Serialization</title>
+ <title>Tutorial 1: Serialization - Django REST framework</title>
<link href="http://django-rest-framework.org/img/favicon.ico" rel="icon" type="image/x-icon">
<link rel="canonical" href="http://django-rest-framework.org/tutorial/1-serialization"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
@@ -431,8 +431,7 @@ def snippet_list(request):
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data, status=201)
- else:
- return JSONResponse(serializer.errors, status=400)
+ return JSONResponse(serializer.errors, status=400)
</code></pre>
<p>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 <code>csrf_exempt</code>. 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. </p>
<p>We'll also need a view which corresponds to an individual snippet, and can be used to retrieve, update or delete the snippet.</p>
@@ -456,8 +455,7 @@ def snippet_detail(request, pk):
if serializer.is_valid():
serializer.save()
return JSONResponse(serializer.data)
- else:
- return JSONResponse(serializer.errors, status=400)
+ return JSONResponse(serializer.errors, status=400)
elif request.method == 'DELETE':
snippet.delete()