Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django create token for user

from rest_framework.authtoken.models import Token

@action(detail=True, methods=['POST'])
    def CreateToken(self, request, pk=None):
        user = User.objects.get(id=pk) 
		Token.objects.create(user=user)
 
PREVIOUS NEXT
Tagged: #django #create #token #user
ADD COMMENT
Topic
Name
9+6 =