auth.models.CustomUser.get_short_name()

get_short_name() A short, informal identifier for the user. A common interpretation would be the first name of the user, but it can be any string that identifies the user in an informal way. It may also return the same value as django.contrib.auth.models.User.get_full_name(). Importing AbstractBaseUser New in Django 1.9. AbstractBaseUser and BaseUserManager are importable from django.contrib.auth.base_user so that they can be imported without including django.contrib.auth in INSTALLED_APP

auth.models.CustomUser.get_full_name()

get_full_name() A longer formal identifier for the user. A common interpretation would be the full name of the user, but it can be any string that identifies the user.

auth.models.CustomUser

class models.CustomUser USERNAME_FIELD A string describing the name of the field on the User model that is used as the unique identifier. This will usually be a username of some kind, but it can also be an email address, or any other unique identifier. The field must be unique (i.e., have unique=True set in its definition), unless you use a custom authentication backend that can support non-unique usernames. In the following example, the field identifier is used as the identifying field:

auth.models.BaseUserManager.make_random_password()

make_random_password(length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789') Returns a random password with the given length and given string of allowed characters. Note that the default value of allowed_chars doesn’t contain letters that can cause user confusion, including: i, l, I, and 1 (lowercase letter i, lowercase letter L, uppercase letter i, and the number one) o, O, and 0 (lowercase letter o, uppercase letter o, and zero)

auth.models.BaseUserManager.get_by_natural_key()

get_by_natural_key(username) Retrieves a user instance using the contents of the field nominated by USERNAME_FIELD.

auth.models.BaseUserManager

class models.BaseUserManager classmethod normalize_email(email) Normalizes email addresses by lowercasing the domain portion of the email address. get_by_natural_key(username) Retrieves a user instance using the contents of the field nominated by USERNAME_FIELD. make_random_password(length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789') Returns a random password with the given length and given string of allowed characters. Note that the default val

auth.models.AnonymousUser

class models.AnonymousUser django.contrib.auth.models.AnonymousUser is a class that implements the django.contrib.auth.models.User interface, with these differences: id is always None. username is always the empty string. get_username() always returns the empty string. is_anonymous is True instead of False. is_authenticated is False instead of True. is_staff and is_superuser are always False. is_active is always False. groups and user_permissions are always empty. set_password(), ch

auth.models.AbstractBaseUser.set_unusable_password()

set_unusable_password() Marks the user as having no password set. This isn’t the same as having a blank string for a password. check_password() for this user will never return True. Doesn’t save the AbstractBaseUser object. You may need this if authentication for your application takes place against an existing external source such as an LDAP directory.

auth.models.AbstractBaseUser.set_password()

set_password(raw_password) Sets the user’s password to the given raw string, taking care of the password hashing. Doesn’t save the AbstractBaseUser object. When the raw_password is None, the password will be set to an unusable password, as if set_unusable_password() were used.

auth.models.AbstractBaseUser.is_authenticated

is_authenticated Read-only attribute which is always True (as opposed to AnonymousUser.is_authenticated which is always False). This is a way to tell if the user has been authenticated. This does not imply any permissions and doesn’t check if the user is active or has a valid session. Even though normally you will check this attribute on request.user to find out whether it has been populated by the AuthenticationMiddleware (representing the currently logged-in user), you should know this att