class models.CustomUserManager
-
create_user(*username_field*, password=None, **other_fields)
-
The prototype of
create_user()
should accept the username field, plus all required fields as arguments. For example, if your user model usesemail
as the username field, and hasdate_of_birth
as a required field, thencreate_user
should be defined as:123def
create_user(
self
, email, date_of_birth, password
=
None
):
# create user here
...
-
create_superuser(*username_field*, password, **other_fields)
-
The prototype of
create_superuser()
should accept the username field, plus all required fields as arguments. For example, if your user model usesemail
as the username field, and hasdate_of_birth
as a required field, thencreate_superuser
should be defined as:123def
create_superuser(
self
, email, date_of_birth, password):
# create superuser here
...
Unlike
create_user()
,create_superuser()
must require the caller to provide a password.
BaseUserManager
provides the following utility methods:
Please login to continue.