Files
music-tag-web/applications/user/views.py
2022-12-12 16:44:26 +08:00

14 lines
422 B
Python

from rest_framework.decorators import action
from rest_framework.response import Response
from component.drf.viewsets import GenericViewSet
class UserViewSets(GenericViewSet):
@action(methods=['GET'], detail=False)
def info(self, request, *args, **kwargs):
return Response({
"username": request.user.username,
"role": "admin" if request.user.is_superuser else "other"
})