← Django learning pathDjango · Module 8 of 10
Authentication and permissions
Log users in and control what they can do.
📖 Key ideas
- django.contrib.auth provides users, groups and permissions.
- Built-in LoginView and LogoutView.
- @login_required protects views.
- request.user gives the current user.
- Passwords are hashed automatically (PBKDF2 by default).
💡 Real-life example: Groups are department badges: give a badge and the person gets all its door permissions.
@login_requiredDecorator requiring login
request.userThe current user
GroupSet of permissions for many users
PBKDF2Default password hashing