Django REST Framework - ListCreateAPIView


DRF tip:

ListCreateAPIView is used for read-write collection endpoints. It accepts GET and POST requests. It combines CreateModelMixin and ListModelMixin.

class ListAddPost(generics.ListCreateAPIView):
    serializer_class = PostSerializer
    queryset = Post.objects.all()

For more, review Concrete Views.