mirror of
https://github.com/xhongc/music-tag-web.git
synced 2026-04-24 10:40:12 +08:00
14 lines
422 B
Python
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"
|
|
})
|