79626061

Date: 2025-05-16 23:51:10
Score: 1.5
Natty:
Report link

For DRF, it is better to use the SessionAuthentication

from rest_framework.authentication import SessionAuthentication


class ApproveOrDeclineUserView(APIView):
    authetication_classes = (SessionAuthentication, )

Or use directly for whole endpoints:

# In your DRF settings
REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.SessionAuthentication',
    ]
}

And don't forget to remove decorator - @method_decorator

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @method_decorator
  • Low reputation (1):
Posted by: Danylo Ehretskyi