Answer the question
In order to leave comments, you need to log in
Is there a redundant check in the user manager?
Hello, in the Django sources I see the following:
def create_superuser(self, username, email=None, password=None, **extra_fields):
extra_fields.setdefault('is_staff', True)
extra_fields.setdefault('is_superuser', True)
if extra_fields.get('is_staff') is not True:
raise ValueError('Superuser must have is_staff=True.')
if extra_fields.get('is_superuser') is not True:
raise ValueError('Superuser must have is_superuser=True.')
return self._create_user(username, email, password, **extra_fields)
def create_superuser(self, email, password, **extra_fields):
for field in ['is_staff', 'is_superuser', 'is_active']:
extra_fields.setdefault(field, True)
if not extra_fields.get(field):
raise ValueError(f'Superuser must have {field}=True.')
return self.create_user(email, password, **extra_fields)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question