Login Required – LoginRequiredMixin
Once you build user authentication functionalities, you may want to control web page access based on users' login status. You can implement this very quickly with LoginRequiredMixin in the class-based view.
LoginRequiredMixin
LoginRequiredMixin is used to check a user's login status and control page access based on the login status. Adding LoginRequiredMixin is very simple, and you just need to inherit LoginRequiredMixin in the class-based view, in which you want to control user access based on the login status.
Two steps to implement:
- Import LoginRequiredMixin from django.contrib.auth.mixins
- Add LoginRequiredMixin as a parent class of the view
Subscribe now for
uninterrupted access.