From ca355baf7ad5206521ae7c738c5972438fcc58ad Mon Sep 17 00:00:00 2001 From: Dhaval Mehta <20968146+dhaval-mehta@users.noreply.github.com> Date: Tue, 23 Jun 2020 13:20:22 +0530 Subject: [PATCH] Add compatibility for DRF 3.12 --- dj_rest_auth/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dj_rest_auth/views.py b/dj_rest_auth/views.py index 21e064c..a5d06d7 100644 --- a/dj_rest_auth/views.py +++ b/dj_rest_auth/views.py @@ -78,10 +78,10 @@ class LoginView(GenericAPIView): 'refresh_token': self.refresh_token } serializer = serializer_class(instance=data, - context={'request': self.request}) + context=self.get_serializer_context()) else: serializer = serializer_class(instance=self.token, - context={'request': self.request}) + context=self.get_serializer_context()) response = Response(serializer.data, status=status.HTTP_200_OK) if getattr(settings, 'REST_USE_JWT', False): @@ -106,7 +106,7 @@ class LoginView(GenericAPIView): def post(self, request, *args, **kwargs): self.request = request self.serializer = self.get_serializer(data=self.request.data, - context={'request': request}) + context=self.get_serializer_context()) self.serializer.is_valid(raise_exception=True) self.login()