diff options
| author | Tom Christie | 2012-10-03 09:46:12 +0100 |
|---|---|---|
| committer | Tom Christie | 2012-10-03 09:46:12 +0100 |
| commit | d8b05201edde0dd3b22d3b57ebeb04a2ed533b95 (patch) | |
| tree | 56ffc76eddfa3fc07da832f98d605767755d8493 /docs/tutorial/3-class-based-views.md | |
| parent | 1a05942166abfc68f83caea535aa44733b1e37a9 (diff) | |
| parent | 637bfa0f8f4f5be4b877109bd744aa66718ececc (diff) | |
| download | django-rest-framework-d8b05201edde0dd3b22d3b57ebeb04a2ed533b95.tar.bz2 | |
Merge branch 'restframework2' of https://github.com/tomchristie/django-rest-framework into restframework2
Diffstat (limited to 'docs/tutorial/3-class-based-views.md')
| -rw-r--r-- | docs/tutorial/3-class-based-views.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/docs/tutorial/3-class-based-views.md b/docs/tutorial/3-class-based-views.md index 663138bd..2f273364 100644 --- a/docs/tutorial/3-class-based-views.md +++ b/docs/tutorial/3-class-based-views.md @@ -28,10 +28,10 @@ We'll start by rewriting the root view as a class based view. All this involves if serializer.is_valid(): comment = serializer.object comment.save() - return Response(serializer.serialized, status=status.HTTP_201_CREATED) - return Response(serializer.serialized_errors, status=status.HTTP_400_BAD_REQUEST) + return Response(serializer.data, status=status.HTTP_201_CREATED) + return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) -So far, so good. It looks pretty similar to the previous case, but we've got better seperation between the different HTTP methods. We'll also need to update the instance view. +So far, so good. It looks pretty similar to the previous case, but we've got better separation between the different HTTP methods. We'll also need to update the instance view. class CommentInstance(APIView): """ @@ -145,7 +145,7 @@ Using the mixin classes we've rewritten the views to use slightly less code than model = Comment serializer_class = CommentSerializer -Wow, that's pretty concise. We've got a huge amount for free, and our code looks like good, clean, idomatic Django. +Wow, that's pretty concise. We've got a huge amount for free, and our code looks like good, clean, idiomatic Django. Next we'll move onto [part 4 of the tutorial][tut-4], where we'll take a look at how we can customize the behavior of our views to support a range of authentication, permissions, throttling and other aspects. |
