I’m using django allauth, and I have two models that inherit from abstractuser.
class CustomUser(AbstractUser):
email = models.EmailField(unique=True)
phone = models.CharField(max_length=20)
indication = models.CharField(max_length=150, blank=True, default="")
USERNAME_FIELD = "email"
REQUIRED_FIELDS = ["username", "phone"]
def __str__(self):
return self.first_name
class Employee(CustomUser):
is_Barber = models.BooleanField(verbose_name="É um barbeiro?")
branch = models.ForeignKey(Branch, on_delete=models.CASCADE, related_name="employee", null=True, blank=True, verbose_name='Filial')
class Meta:
verbose_name = "Funcionário"
verbose_name_plural = "Funcionários"
I registered CustomUser in the settings:
AUTH_USER_MODEL = "core.CustomUser"
The Employee model works, except that I can’t log in with it.