14 lines
455 B
Python
14 lines
455 B
Python
from rest_framework.permissions import IsAuthenticated
|
|
from rest_framework.response import Response
|
|
from rest_framework.views import APIView
|
|
|
|
class MeView(APIView):
|
|
permission_classes = [IsAuthenticated]
|
|
|
|
def get(self,request):
|
|
return Response({
|
|
"id": request.user.id,
|
|
"username": request.user.username,
|
|
"email": request.user.email,
|
|
"is_staff": request.user.is_staff,
|
|
}) |