From feda0b882d76c818b83397d467707a8307695304 Mon Sep 17 00:00:00 2001 From: moonlitgrace Date: Tue, 10 Dec 2024 11:25:25 +0530 Subject: [PATCH] chore: remove unnecessary api common files --- backend/common/api/handlers.py | 11 ----------- backend/common/api/permissions.py | 13 ------------- 2 files changed, 24 deletions(-) delete mode 100644 backend/common/api/handlers.py delete mode 100644 backend/common/api/permissions.py diff --git a/backend/common/api/handlers.py b/backend/common/api/handlers.py deleted file mode 100644 index 3bdd127..0000000 --- a/backend/common/api/handlers.py +++ /dev/null @@ -1,11 +0,0 @@ -from rest_framework.views import exception_handler - - -# https://www.django-rest-framework.org/api-guide/exceptions/#custom-exception-handling -def custom_exception_handler(exc, context): - response = exception_handler(exc, context) - - if response is not None: - response.data['status_code'] = response.status_code # type: ignore - - return response diff --git a/backend/common/api/permissions.py b/backend/common/api/permissions.py deleted file mode 100644 index d05b832..0000000 --- a/backend/common/api/permissions.py +++ /dev/null @@ -1,13 +0,0 @@ -from rest_framework.permissions import SAFE_METHODS, BasePermission - - -class IsQuibblerOrReadOnly(BasePermission): - """ - Custom permission to allow only quibbler of a feature to edit it. - """ - - def has_object_permission(self, request, view, obj): - if request.method in SAFE_METHODS: - return True - - return obj.quibbler == request.user_profile