diff options
| author | Tom Christie | 2012-10-03 01:32:14 -0700 |
|---|---|---|
| committer | Tom Christie | 2012-10-03 01:32:14 -0700 |
| commit | 637bfa0f8f4f5be4b877109bd744aa66718ececc (patch) | |
| tree | 20c5529cf2c2b3061d35d44bb3d52c8646ded5f0 /docs/tutorial/3-class-based-views.md | |
| parent | b89125ef53a2f9e246afd5eda5c8f404a714da76 (diff) | |
| parent | 934492ebd02dfc580fd0dbd9d8a57ca123adb46d (diff) | |
| download | django-rest-framework-637bfa0f8f4f5be4b877109bd744aa66718ececc.tar.bz2 | |
Merge pull request #276 from mattbo/restframework2
Fixed references to serializer.serialized and serializer.serialized_erro...
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 25d5773f..b2b6443c 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. |
