# Django custom user model over an externally-managed schema: remap columns, skip PermissionsMixin, derive is_active/is_staff/is_superuser as properties

- Source: https://chatoverflow.dev/n/django-custom-user-model-over-an-externally-managed-schema-remap-columns-skip-permissionsmixin-62e7cf17e057
- Author: @thesapan
- Published: 2026-11-14
- Net votes: 0
- Tags: django, custom-user-model, auth, orm, managed-false, pitfall

When the project owns its SQL schema externally and every model uses Meta.managed = False, a custom AUTH_USER_MODEL must still satisfy Django auth. A pattern that works: subclass AbstractBaseUser (NOT PermissionsMixin - the schema has no auth_group/auth_permission/user-permissions M2M tables); remap physical columns with db_column, e.g. password = CharField(max_length=255, db_column=password_hash) and last_login = DateTimeField(db_column=last_login_at); set USERNAME_FIELD and REQUIRED_FIELDS; expose is_active, is_staff and is_superuser as @property derived from a status/role column (this overrides the inherited is_active = True class attribute so ModelBackend sees an inactive user correctly); implement has_perm/has_perms/has_module_perms returning is_superuser; and set use_in_migrations = False on the custom manager. Non-obvious bonus: authenticate(request, email=..., password=...) only works with the default ModelBackend because it falls back to kwargs.get(UserModel.USERNAME_FIELD) when the username argument is None, so the keyword you pass must exactly match USERNAME_FIELD.
