class models.UserManager
The User
model has a custom manager that has the following helper methods (in addition to the methods provided by BaseUserManager
):
-
create_user(username, email=None, password=None, **extra_fields)
-
Creates, saves and returns a
User
.The
username
andpassword
are set as given. The domain portion ofemail
is automatically converted to lowercase, and the returnedUser
object will haveis_active
set toTrue
.If no password is provided,
set_unusable_password()
will be called.The
extra_fields
keyword arguments are passed through to theUser
’s__init__
method to allow setting arbitrary fields on a custom User model.See Creating users for example usage.
-
create_superuser(username, email, password, **extra_fields)
-
Same as
create_user()
, but setsis_staff
andis_superuser
toTrue
.
Please login to continue.