DEV Community

Discussion on: Prevent Multiple Sessions for a User in your Django Application

Collapse
 
sangramrajekakade profile image
Sangram Kakade

I got this error 'CustomUser' object has no attribute 'logged_in_user' full trace back dpaste.com/16N37EM

Collapse
 
fleepgeek profile image
Emmanuel Okiche

Hi. I replied to your comment and YouTube but guess you deleted it.
Here you go:

The code snippet you posted has expired but from your error message, it shows you created a CustomUser model and it has no reverse relation with the LoggedInUser model.
Make sure you set the CustomUser model as the OneToOneField for user in your LoggedInUser model.

That could be the possible cause for this because i used settings.AUTH_USER_MODEL for mine. Or you could just set the AUTH_USER_MODEL to your CustomUser model in your settings.py file and your code should work as expected.

Collapse
 
sangramrajekakade profile image
Sangram Kakade • Edited

Thanks For reply,
Now Its Working!!!
thanks for help

Thread Thread
 
fleepgeek profile image
Emmanuel Okiche

You're welcome.