Set serializer_class on ObtainAuthToken view

This commit is contained in:
mdoglio 2015-03-22 12:35:56 +00:00
parent 22569e8202
commit d0126b7e31

View File

@ -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)