Advertisement
robertvari

ViewSet example

Apr 12th, 2020
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.24 KB | None | 0 0
  1. from rest_framework.viewsets import ModelViewSet
  2.  
  3. from .serializers import PostSerializer
  4. from .models import Post
  5.  
  6. class PostView(ModelViewSet):
  7.     queryset = Post.objects.all().order_by("-created")
  8.     serializer_class = PostSerializer
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement