mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-27 03:54:01 +03:00
Merge branch 'patch-2' of https://github.com/asfaltboy/django-rest-framework into fix_authtoken_response
This commit is contained in:
commit
050e228edc
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue
Block a user