Override Delete Method Django Rest Framework
from rest_framework import status,viewsets
from rest_framework.response import Response
from django.http import Http404
class ExampleDestoryViewset(viewset.ModelViewSet):
def destroy(self, request, *args, **kwargs):
try:
instance = self.get_object()
self.perform_destroy(instance)
except Http404:
pass
return Response(status=status.HTTP_204_NO_CONTENT)
Read other posts