I have the following scenario:
My project has two different Django apps, Dashboard and FrontView, with different user groups. Current login urls are as below:
http://127.0.0.1:8000/dashboard/login
http://127.0.0.1:8000/front/login
However, I have a requirement to have a single login url based on the user redirect to the correct app. EG:
URL for logging in
http://127.0.0.1:8000/login
Once logged in, it should redirect the user to two different apps base on the user group.
http://127.0.0.1:8000/dashboard/
http://127.0.0.1:8000/front/
How to achieve this in Django project
Thanks in advance
As you know, a super user considered a user in a way. In order to determine which address your user should go to, you should check whether your user is a superuser or not. If he is a super user, you can send it to the dashboard, otherwise you can send it to the front. you can use
request.user.is_superuserto find that current user is super user or not if he is super user you send it to dashboard (whit redirect method) and if its not you can send it to front.i hope this explanation helps you.