mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 01:20:02 +03:00
Update 3-class-based-views.md
This commit is contained in:
parent
be87eb43b3
commit
622d5a6ef8
|
@ -141,6 +141,15 @@ Using the mixin classes we've rewritten the views to use slightly less code than
|
|||
class SnippetDetail(generics.RetrieveUpdateDestroyAPIView):
|
||||
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.
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user