Merge pull request #52 from ranetpgit/master

Pass context to JWTSerializer and TokenSerializer
This commit is contained in:
Michael 2020-04-21 19:28:20 -05:00 committed by GitHub
commit a2b8c9ca50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -52,9 +52,9 @@ class RegisterView(CreateAPIView):
'access_token': self.access_token, 'access_token': self.access_token,
'refresh_token': self.refresh_token 'refresh_token': self.refresh_token
} }
return JWTSerializer(data).data return JWTSerializer(data, context=self.get_serializer_context()).data
else: else:
return TokenSerializer(user.auth_token).data return TokenSerializer(user.auth_token, context=self.get_serializer_context()).data
def create(self, request, *args, **kwargs): def create(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data) serializer = self.get_serializer(data=request.data)