diff options
| author | amatellanes | 2013-12-23 09:06:03 +0100 |
|---|---|---|
| committer | amatellanes | 2013-12-23 09:06:03 +0100 |
| commit | 2846ddb5d2ba84b3905d4dc0593afe3a0d4b2749 (patch) | |
| tree | 6922257bd3c636dc490239d999f79e3901f3e64e /docs/tutorial/1-serialization.md | |
| parent | 67a2b5a8cbba21ba85bda935390adeee01abd038 (diff) | |
| download | django-rest-framework-2846ddb5d2ba84b3905d4dc0593afe3a0d4b2749.tar.bz2 | |
Simplified some examples in tutorial
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 e015a545..2298df59 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -263,8 +263,7 @@ The root of our API is going to be a view that supports listing all the existing 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) 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. @@ -290,8 +289,7 @@ We'll also need a view which corresponds to an individual snippet, and can be us 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() |
