RetrieveUpdateDestroyAPIView return 204 http status when receive Delete request

Here is my class-based view:

class BookDetail(generics.RetrieveUpdateDestroyAPIView):
    permission_classes = (permissions.IsAuthenticated,)
    queryset = Book.objects.all()
    serializer_class = BookSerializer

When i send the delete request, http status 204 is returned, the book is successfully deleted, but how can i get the 200 status in this case ?


I found the answer:

 def destroy(self, request, *args, **kwargs):
        instance = self.get_object()
        return Response(status=status.HTTP_204_NO_CONTENT)

Just rewrite your desire status code, in my case is status.HTTP_200_OK

Need Your Help

Oracle SQL - Alternative for dynamic query

sql oracle plsql

I have a procedure (see below) which is using dynamic query. I wanted to rewrite this procedure with out using dynamic query. How do I write the conditions below?

WxPython: deriving wx.ListItem but wx.ListCtrl only returns old class

python wxpython listctrl

I've got a small issue with derived classes, namely wx.ListItem with wx.ListCtrl. I succesfully derived wx.ListItem as a MediaItem, the code is not finished but you get the point: