django-auth
Use when working with Django authentication, custom user models, permissions, groups, decorators, password management, session handling, or social auth with django-allauth. Also use when implementing custom auth backends or setting up AUTH_USER_MODEL.
| Model | Source |
|---|---|
| sonnet | pack: python |
Full Reference
django-auth
Section titled “django-auth”Django’s auth system covers user models, password management, permissions, groups, session-based authentication, and a pluggable backend system. Django 5.2 added async auth backend support (aauthenticate(), alogin()). Always set AUTH_USER_MODEL before the first migration — it cannot be changed after without painful migration surgery.
Quick Reference
Section titled “Quick Reference”| Item | Value |
|---|---|
| Package | django.contrib.auth (built-in) |
| Social auth | django-allauth — pip install django-allauth |
| Django version | 5.2 (async auth backends added) |
| Critical setting | AUTH_USER_MODEL = "accounts.User" — set before first migrate |
| User model accessor | get_user_model() — never import User directly |
Reference Index
Section titled “Reference Index”| I want to… | File |
|---|---|
| Set up a custom user model (AbstractUser or AbstractBaseUser) | reference/custom-user-model.md |
| Implement login, logout, registration, and auth backends | reference/authentication.md |
| Manage permissions, groups, and view protection decorators | reference/permissions.md |
| Handle password hashing, validation, and reset flow | reference/passwords-sessions.md |
| Add social login with django-allauth (Google, GitHub, etc.) | reference/social-auth.md |
Usage: Read the reference file matching your current task from the index above. Each file is self-contained with code examples and inline gotchas.
Announcement
Section titled “Announcement”┏━ 🔐 django-auth ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Django auth — users, permissions, sessions, and social login ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛