Pass context to JWTSerializer and TokenSerializer

This commit is contained in:
Ranet P 2020-04-21 18:17:57 +03:00 committed by GitHub
parent 4a46807a1f
commit 2602d66fef
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)