1👍
You essentially need to provide a decorator to your function based view or mixin to your class based view depending on what you’re using.
There are different options depending on what suits your needs
- Login required (obvious)
- Permission required (user must have specific permission)
- User Passes test (given user must satisfy a given requirement)
- Custom (your own decorator to do custom things)
All of these will give you the chance to redirect a user, stopping them from being able to use the view
Source:stackexchange.com