rovercode_web.users.models

Functions

python_2_unicode_compatible(klass) A decorator that defines __unicode__ and __str__ methods under Python 2.
reverse(viewname[, urlconf, args, kwargs, ...])

Classes

AbstractUser(\*args, \*\*kwargs) An abstract base class implementing a fully featured User model with admin-compliant permissions.
User(id, password, last_login, is_superuser, ...)
class rovercode_web.users.models.User(id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined, name)

Bases: django.contrib.auth.models.AbstractUser

_check_field_name_clashes()

Ref #17673.

_check_fields(**kwargs)

Perform all field checks.

_check_id_field()

Check if id field is a primary key.

_check_index_together()

Check the value of “index_together” option.

_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.

_check_m2m_through_same_relationship()

Check if no relationship model is used by more than one m2m field.

_check_managers(**kwargs)

Perform all manager checks.

_check_ordering()

Check “ordering” option – is it a list of strings and do all fields exist?

_check_swappable()

Check if the swapped model exists.

_check_unique_together()

Check the value of “unique_together” option.

_do_insert(manager, using, fields, update_pk, raw)

Do an INSERT. If update_pk is defined then this method should return the new pk for the model.

_do_update(base_qs, using, pk_val, values, update_fields, forced_update)

This method will try to update the model. If the model was updated (in the sense that an update query was done and a matching row was found from the DB) the method will return True.

_get_unique_checks(exclude=None)

Gather a list of checks to perform. Since validate_unique could be called from a ModelForm, some fields may have been excluded; we can’t perform a unique check on a model that is missing fields involved in that check. Fields that did not validate should also be excluded, but they need to be passed in via the exclude argument.

_save_parents(cls, using, update_fields)

Saves all the parents of cls using values from self.

_save_table(raw=False, cls=None, force_insert=False, force_update=False, using=None, update_fields=None)

Does the heavy-lifting involved in saving. Updates or inserts the data for a single table.

check_password(raw_password)

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

clean_fields(exclude=None)

Cleans all fields and raises a ValidationError containing a dict of all validation errors if any occur.

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

Sends an email to this User.

full_clean(exclude=None, validate_unique=True)

Calls clean_fields, clean, and validate_unique, on the model, and raises a ValidationError for any errors that occurred.

get_deferred_fields()

Returns a set containing names of deferred fields for this instance.

get_full_name()

Returns the first_name plus the last_name, with a space in between.

get_group_permissions(obj=None)

Returns a list of permission strings that this user has through their groups. This method queries all available auth backends. If an object is passed in, only permissions matching this object are returned.

get_session_auth_hash()

Return an HMAC of the password field.

get_short_name()

Returns the short name for the user.

get_username()

Return the identifying username for this User

has_module_perms(app_label)

Returns True if the user has any permissions in the given app label. Uses pretty much the same logic as has_perm, above.

has_perm(perm, obj=None)

Returns True if the user has the specified permission. This method queries all available auth backends, but returns 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, permissions for this specific object are checked.

has_perms(perm_list, obj=None)

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

is_anonymous

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

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)

Reloads 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.

save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)

Handles 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.

The ‘raw’ argument is telling save_base not to save any parent models and not to do any changes to the values before save. This is used by fixture loading.

serializable_value(field_name)

Returns the value of the field name for this instance. If the field is a foreign key, returns the id value, instead of the object. If there’s no Field object with this name on the model, the model attribute’s value is returned directly.

Used to serialize a field’s value (in the serializer, or form output, for example). Normally, you would just access the attribute directly and not use this method.

validate_unique(exclude=None)

Checks unique constraints on the model and raises ValidationError if any failed.