Is there are any way to add 2 models as auth-user-model?
i have created 2 apps user and a vendor. This is the error i am facing.
"
AttributeError at /users/admin/login/
Manager isn't available; 'auth.User' has been swapped for 'vendors.Vendor'
Request Method: POST
Request URL: http://127.0.0.1:8000/users/admin/login/
Django Version: 5.1.3
Exception Type: AttributeError
Exception Value:
Manager isn't available; 'auth.User' has been swapped for 'vendors.Vendor'"
Can i add both the Vendor and user ?
No. But here's my suggestion: According to the logs you provided, it seems like you want to replace your old user model with new one. I would recommend going thru': AbstractUser & AbstractBaseUser in django.
Well basically, you may just ask chat gpt on how to configure these in your django project.
NOTE: you would need fresh db.
I hope this helps you!
If the DB is live already, the usual approach is to add a new model, say UserProfile
, and a relation from User
to UserProfile
. Then, program using request.user.profile.whatever
and query User.objects.filter(profile__whatever...