Q: How to perform the delete method in drf django How to perform the delete request in Django drf? How will I pass the params for the request?
Kindly help with the solution. I am very new in this drf-django-python programming.
class DeleteView(APIView):
    def delete(self, request,format=None):
        id = request.POST['book_id']
        email = request.POST['email']
        book = models.Book.objects.filter(book_id=id)
        book_uploader = serializers.BookSerializer(book[0]).data['uploader']['email']
        logged_in = request.user
        print(log)
        if book_uploader == logged_in :

            books = models.BookUserRelationship.objects.filter(book= id, user__email=email)

            books.delete()
            return Response("Successfully removed", status=status.HTTP_204_NO_CONTENT)
        else :
            return Response("Not able to remove")


A: In comments you noticed that parameters will be embedded in url but you are trying to get values from POST dict.
If your url is something like 

/books/id/email/

You should use request.kwargs dict like request.kwargs.get('email')
But if your url is like 

/books/id/?email=someemail@google.com

id would be in request.kwargs but email in request.query_params
Notice that every url variable is in the request.query_params dict.
IMPORTANT
If you have ID url param without named group, viewset would not be able to get this from request.kwargs by name
