Sachin
Sachin

Reputation: 3782

UserProfile matching query does not exist

I had my project running absolutely until I tried to access the my custom UserProfile object in the account view of allauth. Since then I have any consistently getting this error when I try to access any page of my project.

Can anybody point me in the right direction.

Upvotes: 0

Views: 717

Answers (1)

Sachin
Sachin

Reputation: 3782

I actually figured out the problem myself. It was really a very stupid mistake, but I am still putting out the answer out there as it might help some naive user like me... Actually I was using a middleware that access the userprofile and updates a count. It was running fine because I was accessing the site from admin account and the user profile was already created.

But when I logged out and signed in a user whose profile was not created... This problem came up. The middleware was trying to access the userprofile on any visiting page of my site as it is a middleware.

So what I did was, that I changed my middle ware to access a userprofile only if it has been created.

Upvotes: 1

Related Questions