-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
Please allow different user types using different models for authentication #9598
Comments
please assign this to me , i want to work on this @MuhammadWaqarAnwar |
@MuhammadWaqarAnwar This is not a DRF limitation but a Django restriction. Django’s AUTH_USER_MODEL can only point to one user model, as it’s deeply integrated with the authentication system. To support multiple user models, you can use custom authentication backends or handle different user types (e.g., admin vs. regular users) within a single model or via separate views. |
You can also use separate models for each category of user you want and inherit them from a single, unified authentication model that Django will use for authentication. |
you can add one boolean field in the User Model and option like login as admin or normal user: default False |
Checklist
i have made different JWT authentications for different user models (admin and simple user). But the problem is that in
settings.py
theAUTH_USER_MODEL
can only allow one user authentication.Hence the problem appears where if i authenticate in admin section from admin credentials, then it doesn't allow and says invalid credentials. but if i authenticate in admin section from normal user credentials then it is allowed. because in
settings.py
theAUTH_USER_MODEL
equals tousers.User
and not the other Admin User. please develop this new feature where we are allowed to have more than 1AUTH_USER_MODELS
insettings.py
The text was updated successfully, but these errors were encountered: