bradtraversy / lead_manager_react_django

Full stack app with React, Redux & Django
592 stars 316 forks source link

'AnonymousUser' object has no attribute 'leads' #43

Open Sandeep1904 opened 3 years ago

Sandeep1904 commented 3 years ago

In api.py of the leads app, in the function def get_querysetself): return self.request.user.leads.all()

Then I looked up and found that at the URL '/api/auth/login/', I'm not even getting a form in the API view of the rest framework. So I can't even post on the URL to login. Register is working, it creates users perfectly. Problem is somewhere in LoginSerializer class.

When I visit '..../api/auth/login/' I get this without a post form.

GET /api/auth/login/ HTTP 401 Unauthorized Allow: POST, OPTIONS Content-Type: application/json Vary: Accept WWW-Authenticate: Token

{ "detail": "Authentication credentials were not provided." }