def create(self, data):
    'Generate or retrieve new token'
    (token, created) = Token.objects.get_or_create(user=self.context['user'])
    return (self.context['user'], token.key)
Generate or retrieve new token
def create(self, data):
    
    (token, created) = Token.objects.get_or_create(user=self.context['user'])
    return (self.context['user'], token.key)