diff options
| author | amatellanes | 2013-12-23 08:50:46 +0100 | 
|---|---|---|
| committer | amatellanes | 2013-12-23 08:50:46 +0100 | 
| commit | d6806340e54408858da4b2dc991be99edd65df76 (patch) | |
| tree | 6922257bd3c636dc490239d999f79e3901f3e64e /docs/tutorial/2-requests-and-responses.md | |
| parent | 2d6d725c2f7f2226f9287211e64037816f8f2cac (diff) | |
| download | django-rest-framework-d6806340e54408858da4b2dc991be99edd65df76.tar.bz2 | |
Simplified some examples in tutorial
Diffstat (limited to 'docs/tutorial/2-requests-and-responses.md')
| -rw-r--r-- | docs/tutorial/2-requests-and-responses.md | 6 | 
1 files changed, 2 insertions, 4 deletions
| diff --git a/docs/tutorial/2-requests-and-responses.md b/docs/tutorial/2-requests-and-responses.md index 7fa4f3e4..603edd08 100644 --- a/docs/tutorial/2-requests-and-responses.md +++ b/docs/tutorial/2-requests-and-responses.md @@ -59,8 +59,7 @@ We don't need our `JSONResponse` class in `views.py` anymore, so go ahead and de              if serializer.is_valid():                  serializer.save()                  return Response(serializer.data, status=status.HTTP_201_CREATED) -            else: -                return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)  Our instance view is an improvement over the previous example.  It's a little more concise, and the code now feels very similar to if we were working with the Forms API.  We're also using named status codes, which makes the response meanings more obvious. @@ -85,8 +84,7 @@ Here is the view for an individual snippet, in the `views.py` module.              if serializer.is_valid():                  serializer.save()                  return Response(serializer.data) -            else: -                return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) +            return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)          elif request.method == 'DELETE':              snippet.delete() | 
