Commit 050e228e by Pavel Savchenko

Merge branch 'patch-2' of https://github.com/asfaltboy/django-rest-framework…

Merge branch 'patch-2' of https://github.com/asfaltboy/django-rest-framework into fix_authtoken_response
parents 0a4c9f08 7eec582d
......@@ -18,7 +18,7 @@ class ObtainAuthToken(APIView):
if serializer.is_valid():
token, created = Token.objects.get_or_create(user=serializer.object['user'])
return Response({'token': token.key})
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
return Response(serializer.errors, status=status.HTTP_401_UNAUTHORIZED)
obtain_auth_token = ObtainAuthToken.as_view()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment