Django REST Framework - DestroyAPIView


DRF tip:

DestroyAPIView is used for delete-only single instance endpoints and only accepts DELETE requests. It extends DestroyModelMixin.

class DeletePost(generics.DestroyAPIView):
    serializer_class = PostSerializer
    queryset = Post.objects.all()

For more, review Concrete Views.