from django.contrib.auth.models import AbstractUser
class Customer(AbstractUser):
email = models.EmailField(
verbose_name='email address',
max_length=55,
unique=True,
error_messages={
'unique': _("A user with that email already exists."),
},
)
In settings, I have AUTH_USER_MODEL = "core.Customer"
But in my tests when I try to create an user through reverse("registration_register"), I have the issue bellow:
AttributeError: Manager isn't available; 'auth.User' has been swapped for 'core.Customer'
Checking the code, I found that RegistrationForm.Meta.Model is auth.User instead of core.Customer.
So, to fix I just set User(comes from get_user_model()) explicitly:
I have simple and custom User model
models.py
In settings, I have
AUTH_USER_MODEL = "core.Customer"
But in my tests when I try to create an user through
reverse("registration_register")
, I have the issue bellow:Checking the code, I found that
RegistrationForm.Meta.Model
isauth.User
instead ofcore.Customer
.So, to fix I just set User(comes from get_user_model()) explicitly:
Am I missing something?