Redirect to admin page

Hi

I have a button that when clicked i need to redirect to the admin page

webpage.com/admin

If the user is not admin then the user has to enter the username and password.

If the user is admin then it will go directly to the admin page logged in.

Thanks

Hello!
On Django documentation “Limiting access to logged in users” you can see two ways to do it.

Actually, that’s the default behavior.

Create your link to webpage.com/admin and it will function as you describe.

2 Likes