Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. AttributeError: 'Request' object has no attribute 'body'
  2.  
  3. During handling of the above exception, another exception occurred:
  4. raise RawPostDataException("You cannot access body after reading from request's data stream")
  5. django.http.request.RawPostDataException: You cannot access body after reading from request's data stream
  6.  
  7. @api_view(['POST'])
  8. def login(request):
  9.  
  10. email = request.POST['email']
  11. password = request.POST['password']
  12. user = authenticate(email=email, password=password)
  13. if user is not None:
  14. login(request)
  15. print("Breakpoint")
  16. return Response(status=status.HTTP_200_OK)
  17. print('something went wrong')
  18. return Response(status=status.HTTP_401_UNAUTHORIZED)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement