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

AbstractUser is not effective #4292

Open
xuqiang-idotools opened this issue Apr 30, 2024 · 1 comment
Open

AbstractUser is not effective #4292

xuqiang-idotools opened this issue Apr 30, 2024 · 1 comment

Comments

@xuqiang-idotools
Copy link

xuqiang-idotools commented Apr 30, 2024

Found a bug? Please fill out the sections below.

Issue Summary

I found the model "oscar.apps.customer.abstract_models.AbstractUser" is not be registered.
So the model "django.contrib.auth.models.AbstractUser" is being used.
Is it losing the register code like this :

if not is_model_registered("customer", "User"):

class User(abstract_models.AbstractUser):
    pass

__all__.append("User")

And I subclass the AbstractUser, got the error: "ValueError: Related model 'customer.user' cannot be resolved" on migrating.
I like a circle denpendency by "customer.0001_initial.py".

Steps to Reproduce

Technical details

  • Python version: Python 3.12.3
  • Django version: Version: 4.2.11
  • Oscar version: Version: 3.2.4
@joeyjurjens
Copy link
Contributor

I don't think the AbstractUser model is used by default and that they make use of Django's own setting to customize the user model (AUTH_USER_MODEL);
https://django-oscar.readthedocs.io/en/3.0.0/howto/use_a_custom_user_model.html

See the #Example section
https://django-oscar.readthedocs.io/en/3.2.4/howto/use_a_custom_user_model.html#example

Keep in mind that if you already have dependencies on the user model you might run into issues, read;
https://docs.djangoproject.com/en/5.0/ref/settings/#auth-user-model

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