问题
I have a token string from Django REST Framework's TokenAuthentication.
I need to get the corresponding user object. How would I go about doing this?
回答1:
from rest_framework.authtoken.models import Token
user = Token.objects.get(key='token string').user
来源:https://stackoverflow.com/questions/44212188/get-user-object-from-token-string-in-drf