自定义用户模型 可以替代 Django 默认的 User,以满足应用程序的需求 — 添加字段、改变登录标识符(例如用电子邮件替代用户名),或自定义行为。关键的、反复强调的建议是:在项目的最初阶段 设置自定义用户模型,即使你现在不需要更改,因为稍后更改它会非常痛苦。
为什么:默认 User 功能有限且之后难以更改
The default User has fixed fields (username, email, first/last name) and uses
USERNAME as the login field. Real apps often need:
✓ Email-based login (no username)
✓ Extra fields (phone, avatar, role, preferences) on the user itself
✓ Custom authentication behavior
