From d0126b7e31c69ea7dd5cda4b9a3e931f5b8a8fbf Mon Sep 17 00:00:00 2001 From: mdoglio Date: Sun, 22 Mar 2015 12:35:56 +0000 Subject: [PATCH] Set serializer_class on ObtainAuthToken view --- rest_framework/authtoken/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/authtoken/views.py b/rest_framework/authtoken/views.py index b75c2e252..66bbc49b7 100644 --- a/rest_framework/authtoken/views.py +++ b/rest_framework/authtoken/views.py @@ -11,9 +11,10 @@ class ObtainAuthToken(APIView): permission_classes = () parser_classes = (parsers.FormParser, parsers.MultiPartParser, parsers.JSONParser,) renderer_classes = (renderers.JSONRenderer,) + serializer_class = AuthTokenSerializer def post(self, request): - serializer = AuthTokenSerializer(data=request.data) + serializer = self.serializer_class(data=request.data) serializer.is_valid(raise_exception=True) user = serializer.validated_data['user'] token, created = Token.objects.get_or_create(user=user)