Django REST Framework - CreateAPIView


DRF tip:

CreateAPIView is used for create-only endpoints and only accepts POST requests. It extends CreateModelMixin.

class CreatePost(generics.CreateAPIView):
    serializer_class = PostSerializer
    queryset = Post.objects.all()

For more, review Concrete Views.