class documentation

class AbstractUser(AbstractBaseUser, PermissionsMixin):

Known subclasses: django.contrib.auth.models.User

View In Hierarchy

An abstract base class implementing a fully featured User model with admin-compliant permissions.

Username and password are required. Other fields are optional.

Method clean No summary
Constant EMAIL​_FIELD Undocumented
Constant REQUIRED​_FIELDS Undocumented
Constant USERNAME​_FIELD Undocumented
Class ​Meta Undocumented
Method email​_user Send an email to this user.
Method get​_full​_name Return the first_name plus the last_name, with a space in between.
Method get​_short​_name Return the short name for the user.
Class Variable date​_joined Undocumented
Class Variable first​_name Undocumented
Class Variable is​_active Undocumented
Class Variable is​_staff Undocumented
Class Variable last​_name Undocumented
Class Variable objects Undocumented
Class Variable username Undocumented
Class Variable username​_validator Undocumented
Instance Variable email Undocumented

Inherited from AbstractBaseUser:

Class Method get​_email​_field​_name Undocumented
Class Method normalize​_username Undocumented
Method __str__ Undocumented
Method check​_password Return a boolean of whether the raw_password was correct. Handles hashing formats behind the scenes.
Method get​_session​_auth​_hash Return an HMAC of the password field.
Method get​_username Return the username for this User.
Method has​_usable​_password Return False if set_unusable_password() has been called for this user.
Method natural​_key Undocumented
Method save Save the current instance. Override this in a subclass if you want to control the saving process.
Method set​_password Undocumented
Method set​_unusable​_password Undocumented
Class Variable last​_login Undocumented
Instance Variable ​_password Undocumented
Instance Variable password Undocumented
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.

Inherited from Model (via AbstractBaseUser):

Class Method check Undocumented
Class Method from​_db Undocumented
Class Method ​_check​_column​_name​_clashes Undocumented
Class Method ​_check​_constraints Undocumented
Class Method ​_check​_default​_pk Undocumented
Class Method ​_check​_field​_name​_clashes Forbid field shadowing in multi-table inheritance.
Class Method ​_check​_fields Perform all field checks.
Class Method ​_check​_id​_field Check if id field is a primary key.
Class Method ​_check​_index​_together Check the value of "index_together" option.
Class Method ​_check​_indexes Check fields, names, and conditions of indexes.
Class Method ​_check​_local​_fields Undocumented
Class Method ​_check​_long​_column​_names Check that any auto-generated column names are shorter than the limits for each database in which the model will be created.
Class Method ​_check​_m2m​_through​_same​_relationship Check if no relationship model is used by more than one m2m field.
Class Method ​_check​_managers Perform all manager checks.
Class Method ​_check​_model Undocumented
Class Method ​_check​_model​_name​_db​_lookup​_clashes Undocumented
Class Method ​_check​_ordering Check "ordering" option -- is it a list of strings and do all fields exist?
Class Method ​_check​_property​_name​_related​_field​_accessor​_clashes Undocumented
Class Method ​_check​_single​_primary​_key Undocumented
Class Method ​_check​_swappable Check if the swapped model exists.
Class Method ​_check​_unique​_together Check the value of "unique_together" option.
Class Method ​_get​_expr​_references Undocumented
Method __eq__ Undocumented
Method __getstate__ Hook to allow choosing the attributes to pickle.
Method __hash__ Undocumented
Method __init__ Undocumented
Method __reduce__ Undocumented
Method __repr__ Undocumented
Method __setstate__ Undocumented
Method ​_do​_insert Do an INSERT. If returning_fields is defined then this method should return the newly created data for the model.
Method ​_do​_update Try to update the model. Return True if the model was updated (if an update query was done and a matching row was found in the DB).
Method _get_​FIELD_display Undocumented
Method _get_next_or_previous_by_​FIELD Undocumented
Method ​_get​_next​_or​_previous​_in​_order Undocumented
Method ​_get​_pk​_val Undocumented
Method ​_get​_unique​_checks No summary
Method ​_perform​_date​_checks Undocumented
Method ​_perform​_unique​_checks Undocumented
Method ​_prepare​_related​_fields​_for​_save Undocumented
Method ​_save​_parents Save all the parents of cls using values from self.
Method ​_save​_table Do the heavy-lifting involved in saving. Update or insert the data for a single table.
Method ​_set​_pk​_val Undocumented
Method clean​_fields Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
Method date​_error​_message Undocumented
Method delete Undocumented
Method full​_clean Call clean_fields(), clean(), and validate_unique() on the model. Raise a ValidationError for any errors that occur.
Method get​_deferred​_fields Return a set containing names of deferred fields for this instance.
Method prepare​_database​_save Undocumented
Method refresh​_from​_db Reload field values from the database.
Method save​_base Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
Method serializable​_value No summary
Method unique​_error​_message Undocumented
Method validate​_unique Check unique constraints on the model and raise ValidationError if any failed.
Class Variable pk Undocumented
Instance Variable ​_order Undocumented
Instance Variable ​_prefetched​_objects​_cache Undocumented
Instance Variable ​_state Undocumented

Inherited from PermissionsMixin:

Method get​_all​_permissions Undocumented
Method get​_group​_permissions Return a list of permission strings that this user has through their groups. Query all available auth backends. If an object is passed in, return only permissions matching this object.
Method get​_user​_permissions Return a list of permission strings that this user has directly. Query all available auth backends. If an object is passed in, return only permissions matching this object.
Method has​_module​_perms Return True if the user has any permissions in the given app label. Use similar logic as has_perm(), above.
Method has​_perm No summary
Method has​_perms 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.
Class Variable is​_superuser Undocumented
Class Variable groups Undocumented
Class Variable user​_permissions Undocumented

Inherited from Model (via PermissionsMixin):

Class Method check Undocumented
Class Method from​_db Undocumented
Class Method ​_check​_column​_name​_clashes Undocumented
Class Method ​_check​_constraints Undocumented
Class Method ​_check​_default​_pk Undocumented
Class Method ​_check​_field​_name​_clashes Forbid field shadowing in multi-table inheritance.
Class Method ​_check​_fields Perform all field checks.
Class Method ​_check​_id​_field Check if id field is a primary key.
Class Method ​_check​_index​_together Check the value of "index_together" option.
Class Method ​_check​_indexes Check fields, names, and conditions of indexes.
Class Method ​_check​_local​_fields Undocumented
Class Method ​_check​_long​_column​_names Check that any auto-generated column names are shorter than the limits for each database in which the model will be created.
Class Method ​_check​_m2m​_through​_same​_relationship Check if no relationship model is used by more than one m2m field.
Class Method ​_check​_managers Perform all manager checks.
Class Method ​_check​_model Undocumented
Class Method ​_check​_model​_name​_db​_lookup​_clashes Undocumented
Class Method ​_check​_ordering Check "ordering" option -- is it a list of strings and do all fields exist?
Class Method ​_check​_property​_name​_related​_field​_accessor​_clashes Undocumented
Class Method ​_check​_single​_primary​_key Undocumented
Class Method ​_check​_swappable Check if the swapped model exists.
Class Method ​_check​_unique​_together Check the value of "unique_together" option.
Class Method ​_get​_expr​_references Undocumented
Method __eq__ Undocumented
Method __getstate__ Hook to allow choosing the attributes to pickle.
Method __hash__ Undocumented
Method __init__ Undocumented
Method __reduce__ Undocumented
Method __repr__ Undocumented
Method __setstate__ Undocumented
Method __str__ Undocumented
Method ​_do​_insert Do an INSERT. If returning_fields is defined then this method should return the newly created data for the model.
Method ​_do​_update Try to update the model. Return True if the model was updated (if an update query was done and a matching row was found in the DB).
Method _get_​FIELD_display Undocumented
Method _get_next_or_previous_by_​FIELD Undocumented
Method ​_get​_next​_or​_previous​_in​_order Undocumented
Method ​_get​_pk​_val Undocumented
Method ​_get​_unique​_checks No summary
Method ​_perform​_date​_checks Undocumented
Method ​_perform​_unique​_checks Undocumented
Method ​_prepare​_related​_fields​_for​_save Undocumented
Method ​_save​_parents Save all the parents of cls using values from self.
Method ​_save​_table Do the heavy-lifting involved in saving. Update or insert the data for a single table.
Method ​_set​_pk​_val Undocumented
Method clean​_fields Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
Method date​_error​_message Undocumented
Method delete Undocumented
Method full​_clean Call clean_fields(), clean(), and validate_unique() on the model. Raise a ValidationError for any errors that occur.
Method get​_deferred​_fields Return a set containing names of deferred fields for this instance.
Method prepare​_database​_save Undocumented
Method refresh​_from​_db Reload field values from the database.
Method save Save the current instance. Override this in a subclass if you want to control the saving process.
Method save​_base Handle the parts of saving which should be done only once per save, yet need to be done in raw saves, too. This includes some sanity checks and signal sending.
Method serializable​_value No summary
Method unique​_error​_message Undocumented
Method validate​_unique Check unique constraints on the model and raise ValidationError if any failed.
Class Variable pk Undocumented
Instance Variable ​_order Undocumented
Instance Variable ​_prefetched​_objects​_cache Undocumented
Instance Variable ​_state Undocumented
def clean(self):
Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
EMAIL_FIELD: str =

Undocumented

Value
'email'
REQUIRED_FIELDS: list[str] =
USERNAME_FIELD: str =

Undocumented

Value
'username'
def email_user(self, subject, message, from_email=None, **kwargs):
Send an email to this user.
def get_full_name(self):
Return the first_name plus the last_name, with a space in between.
def get_short_name(self):
Return the short name for the user.
date_joined =

Undocumented

first_name =

Undocumented

is_staff =

Undocumented

last_name =

Undocumented

objects =

Undocumented

username =

Undocumented

username_validator =

Undocumented

email =

Undocumented