Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Sandeep1904 opened this issue Jan 12, 2021 · 0 comments
Open

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

Sandeep1904 opened this issue Jan 12, 2021 · 0 comments

Comments

@Sandeep1904
Copy link

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."
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant