Improved User Model

class improved_user.models.User(email, password, short_name=None, full_name=None)[source]

Bases: improved_user.model_mixins.AbstractUser

The Improved User Model is intended to be used out-of-the-box.

Do not import this model directly: use get_user_model().

Parameters
  • id (AutoField) – Id

  • date_joined (DateTimeField) – Date joined

  • email (EmailField) – Email address

  • full_name (CharField) – Full name

  • groups (ManyToManyField) – The groups this user belongs to. A user will get all permissions granted to each of their groups.

  • is_active (BooleanField) – Designates whether this user should be treated as active. Unselect this instead of deleting accounts.

  • is_staff (BooleanField) – Designates whether the user can log into the admin site.

  • is_superuser (BooleanField) – Designates that this user has all permissions without explicitly assigning them.

  • last_login (DateTimeField) – Last login

  • password (CharField) – Password

  • short_name (CharField) – Short name

  • user_permissions (ManyToManyField) – Specific permissions for this user.

check_password(raw_password)

Return a boolean of whether the raw_password was correct. Handles hashing formats behind the scenes.

clean()

Override default clean method to normalize email.

Call super().clean() if overriding.

email_user(subject, message, from_email=None, **kwargs)

Send an email to this User.

get_full_name()

Return the full name of the user.

get_short_name()

Return the short name for the user.

get_username()

Return the username for this User.

has_module_perms(app_label)

Return True if the user has any permissions in the given app label. Use similar logic as has_perm(), above.

has_perm(perm, obj=None)

Return True if the user has the specified permission. Query all available auth backends, but return immediately if any backend returns True. Thus, a user who has permission from a single auth backend is assumed to have permission in general. If an object is provided, check permissions for that object.

has_perms(perm_list, obj=None)

Return True if the user has each of the specified permissions. If object is passed, check if the user has all required perms for it.

property is_anonymous

Always return False. This is a way of comparing User objects to anonymous users.

property is_authenticated

Always return True. This is a way to tell if the user has been authenticated in templates.

refresh_from_db(using=None, fields=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.