mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-28 19:46:46 +00:00
- Other request methods need love too! (cherry picked from commit 59ffdcaa1906f306378984d12cc40f61c7b80621) (cherry picked from commit b89a120f9e673845e67ad6729bddb6a77974472d) Co-authored-by: Oliver <oliver.henry.walters@gmail.com>
This commit is contained in:
parent
73768bfee1
commit
385e7cb478
@ -59,14 +59,39 @@ class NotFoundView(AjaxView):
|
|||||||
|
|
||||||
permission_classes = [permissions.AllowAny]
|
permission_classes = [permissions.AllowAny]
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def not_found(self, request):
|
||||||
"""Process an `not found` event on the API."""
|
"""Return a 404 error"""
|
||||||
data = {
|
return JsonResponse(
|
||||||
'details': _('API endpoint not found'),
|
{
|
||||||
'url': request.build_absolute_uri(),
|
'detail': _('API endpoint not found'),
|
||||||
}
|
'url': request.build_absolute_uri(),
|
||||||
|
},
|
||||||
|
status=404
|
||||||
|
)
|
||||||
|
|
||||||
return JsonResponse(data, status=404)
|
def options(self, request, *args, **kwargs):
|
||||||
|
"""Return 404"""
|
||||||
|
return self.not_found(request)
|
||||||
|
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
"""Return 404"""
|
||||||
|
return self.not_found(request)
|
||||||
|
|
||||||
|
def post(self, request, *args, **kwargs):
|
||||||
|
"""Return 404"""
|
||||||
|
return self.not_found(request)
|
||||||
|
|
||||||
|
def patch(self, request, *args, **kwargs):
|
||||||
|
"""Return 404"""
|
||||||
|
return self.not_found(request)
|
||||||
|
|
||||||
|
def put(self, request, *args, **kwargs):
|
||||||
|
"""Return 404"""
|
||||||
|
return self.not_found(request)
|
||||||
|
|
||||||
|
def delete(self, request, *args, **kwargs):
|
||||||
|
"""Return 404"""
|
||||||
|
return self.not_found(request)
|
||||||
|
|
||||||
|
|
||||||
class BulkDeleteMixin:
|
class BulkDeleteMixin:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user