From c5d79f6f2702f9d80b9a806ff5f6a987812257af Mon Sep 17 00:00:00 2001 From: Marcin Gordziejewski Date: Sun, 21 Feb 2016 17:37:29 +0100 Subject: [PATCH] Add context to response_serializer in LoginView When context is missing, FileField cannot return absolute urls, that made inconsistency when used absolute urls everywhere else. serializer_class got it injected by inherited APIView, while custom serializer that is defined here didn't. This commit fixes it. --- rest_auth/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_auth/views.py b/rest_auth/views.py index 3bb6f6b..73d188a 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -41,7 +41,7 @@ class LoginView(GenericAPIView): def get_response(self): return Response( - self.response_serializer(self.token).data, status=status.HTTP_200_OK + self.response_serializer(self.token, context=self.get_serializer_context()).data, status=status.HTTP_200_OK ) def post(self, request, *args, **kwargs):