mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
Update 3-class-based-views.md
This commit is contained in:
parent
be87eb43b3
commit
622d5a6ef8
|
@ -142,6 +142,15 @@ Using the mixin classes we've rewritten the views to use slightly less code than
|
|||
queryset = Snippet.objects.all()
|
||||
serializer_class = SnippetSerializer
|
||||
|
||||
class SnippetUpdate(generics.UpdateAPIView):
|
||||
queryset = Snippet.objects.all()
|
||||
serializer_class = SnippetSerializer
|
||||
|
||||
class SnippetDestroy(generics.DestroyAPIView):
|
||||
queryset = Snippet.objects.all()
|
||||
serializer_class = SnippetSerializer
|
||||
|
||||
|
||||
Wow, that's pretty concise. We've gotten 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 deal with authentication and permissions for our API.
|
||||
|
|
Loading…
Reference in New Issue
Block a user