Skip to content

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.

ModelSource
sonnetpack: python
Full Reference

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.

ItemValue
Packagedjango.contrib.auth (built-in)
Social authdjango-allauthpip install django-allauth
Django version5.2 (async auth backends added)
Critical settingAUTH_USER_MODEL = "accounts.User" — set before first migrate
User model accessorget_user_model() — never import User directly
I want to…File
Set up a custom user model (AbstractUser or AbstractBaseUser)reference/custom-user-model.md
Implement login, logout, registration, and auth backendsreference/authentication.md
Manage permissions, groups, and view protection decoratorsreference/permissions.md
Handle password hashing, validation, and reset flowreference/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.


┏━ 🔐 django-auth ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ ┃ Django auth — users, permissions, sessions, and social login ┃ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛