class DestroyModelMixin
from rest_framework.mixins import DestroyModelMixin
Documentation
Source code
Destroy a model instance.
Ancestors (MRO)
- DestroyModelMixin
Methods used but not implemented in this class
- get_object
Methods
def
destroy(self, request, *args, **kwargs):
¶
DestroyModelMixin
def destroy(self, request, *args, **kwargs):
instance = self.get_object()
self.perform_destroy(instance)
return Response(status=status.HTTP_204_NO_CONTENT)
def
perform_destroy(self, instance):
¶
DestroyModelMixin
def perform_destroy(self, instance):
instance.delete()