Django erstellen Token für den Benutzer

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)
MitchAloha