Create and save a SuperUser with the given email and password.
(self, email, password, **extra_fields)
| 93 | return self._create_user(email, password, **extra_fields) # type: ignore[no-untyped-call] |
| 94 | |
| 95 | def create_superuser(self, email, password, **extra_fields): # type: ignore[no-untyped-def] |
| 96 | """Create and save a SuperUser with the given email and password.""" |
| 97 | extra_fields.setdefault("is_staff", True) |
| 98 | extra_fields.setdefault("is_superuser", True) |
| 99 | |
| 100 | if extra_fields.get("is_staff") is not True: |
| 101 | raise ValueError("Superuser must have is_staff=True.") |
| 102 | if extra_fields.get("is_superuser") is not True: |
| 103 | raise ValueError("Superuser must have is_superuser=True.") |
| 104 | |
| 105 | return self._create_user(email, password, **extra_fields) # type: ignore[no-untyped-call] |
| 106 | |
| 107 | def get_by_natural_key(self, email): # type: ignore[no-untyped-def] |
| 108 | # Used to allow case insensitive login |