1👍
✅
It looks like you have a regular Django view, so none of the rest framework authentication code will run.
def uuid_details(request, uuid):
You could use the api_view
decorator to turn this into a rest framework view.
from rest_framework.response import Response
from rest_framework.decorators import api_view
@api_view(['GET'])
def uuid_details(request, uuid):
return Response({"message": "user: " + str(request.user)}
0👍
Two things:
- @csrf_exempt doesn’t work on DRF views. It’s for raw Django ones.
- You didn’t use the DRF decorator for function views
It should work once those two points are fixed.
Source:stackexchange.com