[Fixed]-Create_superuser for custom authentication model

1👍

Turns out that the arguments passed to the create_superuser functions must be named the same as the fields in the model.

The error is not present now. (Ive moved on to different errors unfortunately)

class AuthManager(BaseUserManager):
def create_superuser(self, email_address, password, first_name, last_name, language):
    # Keep everyone honest here, make sure the email is valid
    email_address = self.normalize_email(email_address)
    # Make this password great again (w/ salting and hashing)
    password = AbstractBaseUser.set_password(password)
    superuser = AuthLookup()
    superuser.email_address = email
    superuser.password = password
    superuser.first_name = first_name
    superuser.last_name = last_name
    superuser.language = language
    superuser.save(using=self._db)
👤xec86

Leave a comment