mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-02 11:30:12 +03:00
return 404 in DestroyModelMixin
In case self.get_object() returns None we should return a 404.
This commit is contained in:
parent
38b3d0109b
commit
f9de3913ea
|
@ -90,6 +90,8 @@ class DestroyModelMixin(object):
|
|||
"""
|
||||
def destroy(self, request, *args, **kwargs):
|
||||
instance = self.get_object()
|
||||
if not instance:
|
||||
return Response(status=status.HTTP_404_NOT_FOUND)
|
||||
self.perform_destroy(instance)
|
||||
return Response(status=status.HTTP_204_NO_CONTENT)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user