from django.contrib.auth.models import AbstractUser from django.db import models from django.db.models.functions import Lower class User(AbstractUser): """Players and staff share one account model (ADR-54, ADR-56). Staff is a role (`is_staff` plus explicit permissions), not a separate table. """ class Meta: constraints = [ # ADR-38: one case-insensitive namespace. The name is stored as typed. models.UniqueConstraint(Lower("username"), name="accounts_user_username_ci_unique"), ]