Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom user model support #15

Open
radiac opened this issue Mar 29, 2024 · 1 comment
Open

Custom user model support #15

radiac opened this issue Mar 29, 2024 · 1 comment

Comments

@radiac
Copy link

radiac commented Mar 29, 2024

The documented CMS_MIGRATION_USER_ID doesn't seem to be in use at the moment. My guess is that it's intended for use in helpers.get_or_create_migration_user, which doesn't currently work with User models that are missing the username field?

Rather than implementing it by user ID, would it be worth having a dict-based setting which can be passed to get_or_create, so for example if my user model has an email-based login, I could set CMS_MIGRATION_USER={"email": "[email protected]"}

@rvanlaar
Copy link

rvanlaar commented Jun 5, 2024

I found a related issue in 0003_page_version_integration_data_migration.py

The user model is defined as User = apps.get_model(*settings.AUTH_USER_MODEL.split('.'))
This result in a

(Pdb) apps.get_model(*settings.AUTH_USER_MODEL.split('.'))
<class '__fake__.User'>

Recommended is to use get_user_model() per: https://docs.djangoproject.com/en/5.0/topics/auth/customizing/#referencing-the-user-model
As is also done in the function get_or_create_migration_user.

(Pdb) from django.contrib.auth import get_user_model
(Pdb) get_user_model()
<class 'edubroker_kom.edubroker.models.edubrokeraccounts.User'>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants