Red User, Blue User, MyUser, auth.User
summary
Django 1.5 adds true custom user models: choose either AbstractBaseUser (password + last_login) or AbstractUser (full fields) and register it with the AUTH_USER_MODEL setting. Implement a custom manager, creation/change forms and admin class, use get_user_model() for queries, and prefer profiles for noncore data. Changing the user model later is painful — set once before first migration — and watch reverse lookup names or set related_name. Advanced option: mark models swappable via Meta.swappable for pluggable domains.
AI-written summary · about
chapters (8)
- 0:00Introduction to custom users
- 1:32Problems with naming
- 7:00Identity and user models
- 10:20Gender and identity
- 13:30Implementing custom users
- 17:36Best practices for models
- 21:34Using profile models
- 26:11Advanced usage and conclusion
related talks
24mOne database table, one model, many behaviours: Proxy model
25mUnderstanding Django authentication
35mExternal authentication for Django projects
15mDjango URL Pattern Role Authorization System
38mFinally Understand Authentication in Django REST Framework
30mPseu, Pseu, Pseudio. Pseudonymization in Django.
19mPatterns for Extensibility
18mWriting Reusable Django Apps
