You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Confirms the AUTH_USER_MODEL setting-value change ships in the same deployable unit as the rename; only the rest of P7 step 5 (the get_user_model() idiom sweep, django_migrations cleanup) stays deferred
The accounts/identity_inventory.py string-literal fallout this issue must fix
Goal
migrations.RenameModel("CustomUser", "User") and AlterModelTable to accounts_user, AUTH_USER_MODEL updated to "accounts.User" in the same change. End state: model accounts.User, table accounts_user, all rows preserved, zero behavior change.
Scope
The rename migration, using the operation sequence makemigrations generates.
AUTH_USER_MODEL = "accounts.User" in settings, landed atomically with the migration (Django cannot resolve the old model name after the rename — see the linked owner decision).
Fix every now-broken CustomUser import across the codebase.
accounts/identity_inventory.py literal fixes (do not skip — these live in string literals, so neither the import rewrite nor an attribute-access grep catches them):
ACCOUNT_MANY_TO_MANY_RELATIONS: "owner_model": "accounts.CustomUser", the "through_table" values accounts_customuser_groups/accounts_customuser_user_permissions (implicit m2m through tables rename with the model), "user_field": "customuser" (the reverse accessor becomes user).
ACCOUNT_RELATIONS's first entries: "accounts.CustomUser_groups"/"customuser".
By contrast, accounts_customuser literals in accounts/services/cmp_learner_import.py and CmpLearnerImportProgress.table values name the CMP export's source tables, not the live table, and must NOT be touched.
Verify current main for any further CustomUser-literal or accounts.CustomUser model-label string added since D3.1 umbrella: Extension models and user model rename (phased) #334's original grooming (for example in accounts/tests/test_identity_quarantine_revocation.py, accounts/tests/test_username_allocation.py, and the management_auth/management_api modules touched by that same BE-08 fix) before finishing — this table is a floor, not the full inventory.
Non-goals
No get_user_model() idiom sweep beyond fixing imports the rename itself breaks.
No django_migrations cleanup, no squashed-migration --fake, no P5 relabel work.
No AISL field additions (phase 6).
No login-behavior, allauth-adapter, or permission-logic change beyond rename fallout.
get_user_model() resolves to accounts.User with db_tableaccounts_user.
Email login authenticates through the Django test client (login, session, member page 200); the dark-mode toggle endpoint still works end to end through learner_profile.
grep -rn "CustomUser\|accounts_customuser" --include=*.py . | grep -v migrations | grep -v .tmp shows only the CMP-import source-table literals and any deliberately preserved docstring/comment references; the PR body records this grep's output.
manage.py migrate applies cleanly end to end on a fresh database.
Browser
make test-playwright-core passes.
[HUMAN] After the development deploy: login with an existing development account works and the dark-mode toggle persists.
Repository and operations
Versioned verification plan per _docs/ci/change-selective-ci.md recorded in the engineer handoff.
Part of the
D3.1umbrella (#334): phase 5 of 6.P7step 2's model rename, isolated as its own small, final-schema-shape step.Normative sources
community-baserepo:docs/03-playbooks.mdP7DTC step 2AUTH_USER_MODELsetting-value change ships in the same deployable unit as the rename; only the rest ofP7step 5 (theget_user_model()idiom sweep,django_migrationscleanup) stays deferredaccounts/identity_inventory.pystring-literal fallout this issue must fixGoal
migrations.RenameModel("CustomUser", "User")andAlterModelTabletoaccounts_user,AUTH_USER_MODELupdated to"accounts.User"in the same change. End state: modelaccounts.User, tableaccounts_user, all rows preserved, zero behavior change.Scope
makemigrationsgenerates.AUTH_USER_MODEL = "accounts.User"in settings, landed atomically with the migration (Django cannot resolve the old model name after the rename — see the linked owner decision).CustomUserimport across the codebase.accounts/identity_inventory.pyliteral fixes (do not skip — these live in string literals, so neither the import rewrite nor an attribute-access grep catches them):ACCOUNT_MANY_TO_MANY_RELATIONS:"owner_model": "accounts.CustomUser", the"through_table"valuesaccounts_customuser_groups/accounts_customuser_user_permissions(implicit m2m through tables rename with the model),"user_field": "customuser"(the reverse accessor becomesuser).ACCOUNT_RELATIONS's first entries:"accounts.CustomUser_groups"/"customuser".accounts_customuserliterals inaccounts/services/cmp_learner_import.pyandCmpLearnerImportProgress.tablevalues name the CMP export's source tables, not the live table, and must NOT be touched.mainfor any furtherCustomUser-literal oraccounts.CustomUsermodel-label string added since D3.1 umbrella: Extension models and user model rename (phased) #334's original grooming (for example inaccounts/tests/test_identity_quarantine_revocation.py,accounts/tests/test_username_allocation.py, and themanagement_auth/management_apimodules touched by that same BE-08 fix) before finishing — this table is a floor, not the full inventory.Non-goals
get_user_model()idiom sweep beyond fixing imports the rename itself breaks.django_migrationscleanup, no squashed-migration--fake, noP5relabel work.Dependencies
CustomUserrisks the rename migration and the field-removal migration racing on the same table during a rebase).D3.2andC3.7(per D3.1 umbrella: Extension models and user model rename (phased) #334), and D3.1 phase 6: Add AISL-origin reconciliation fields (schema only) #395 (kept last to match the original plan's stated ordering; phase 6 is otherwise independent and could reorder if the owner prefers).Acceptance criteria
Django and integration
make django-check/make migrations-checkpass.make test(full suite) passes.get_user_model()resolves toaccounts.Userwithdb_tableaccounts_user.learner_profile.grep -rn "CustomUser\|accounts_customuser" --include=*.py . | grep -v migrations | grep -v .tmpshows only the CMP-import source-table literals and any deliberately preserved docstring/comment references; the PR body records this grep's output.manage.py migrateapplies cleanly end to end on a fresh database.Browser
make test-playwright-corepasses.Repository and operations
_docs/ci/change-selective-ci.mdrecorded in the engineer handoff.