Users
This package contains all user-related data models:
User
,
Organization
and
FidoKey
(see also django.contrib.auth.models.User
for Django’s base user model)
Organization
- class integreat_cms.cms.models.users.organization.Organization(*args, **kwargs)[source]
Bases:
AbstractBaseModel
Data model representing an organization
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) – Name
slug (SlugField) – Slug. Unique string identifier without spaces and special characters.
last_updated (DateTimeField) – Modification date
created_date (DateTimeField) – Creation date
website (URLField) – Website
archived (BooleanField) – Archived
Relationship fields:
- Parameters:
icon (
ForeignKey
toMediaFile
) – Logo (related name:icon_organizations
)region (
ForeignKey
toRegion
) – Region (related name:organizations
)links (
GenericRelation
toLink
) – Links (related name:organization
)
Reverse relationships:
- Parameters:
pois (Reverse
ForeignKey
fromPOI
) – All pois of this organization (related name oforganization
)pages (Reverse
ForeignKey
fromPage
) – All pages of this organization (related name oforganization
)members (Reverse
ForeignKey
fromUser
) – All members of this organization (related name oforganization
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- archived[source]
Type:
BooleanField
Archived
- backend_edit_link[source]
This function returns the absolute url to the edit form of this region
- Returns:
The url
- clean()[source]
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.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_date[source]
Type:
DateTimeField
Creation date
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=True, **kwargs)[source]
Finds next instance based on
created_date
. Seeget_next_by_FOO()
for more information.
- get_next_by_last_updated(*, field=<django.db.models.DateTimeField: last_updated>, is_next=True, **kwargs)[source]
Finds next instance based on
last_updated
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_date(*, field=<django.db.models.DateTimeField: created_date>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_date
. Seeget_previous_by_FOO()
for more information.
- get_previous_by_last_updated(*, field=<django.db.models.DateTimeField: last_updated>, is_next=False, **kwargs)[source]
Finds previous instance based on
last_updated
. Seeget_previous_by_FOO()
for more information.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Organization: Organization object (id)>
. It is used for logging.- Returns:
The canonical string representation of the organization
- Return type:
- icon[source]
Type:
ForeignKey
toMediaFile
Logo (related name:
icon_organizations
)
- id[source]
Type:
BigAutoField
Primary key: ID
- last_updated[source]
Type:
DateTimeField
Modification date
- links[source]
Type: Reverse
GenericRelation
fromOrganization
All organization of this link (related name of
links
)
- members[source]
Type: Reverse
ForeignKey
fromUser
All members of this organization (related name of
organization
)
- property num_contents: int[source]
- Returns:
the current number of maintained pages of an organization object
- pages[source]
Type: Reverse
ForeignKey
fromPage
All pages of this organization (related name of
organization
)
- pois[source]
Type: Reverse
ForeignKey
fromPOI
All pois of this organization (related name of
organization
)
- refresh_from_db(using=None, fields=None)[source]
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.
- region[source]
Type:
ForeignKey
toRegion
Region (related name:
organizations
)
- replace_urls(urls_to_replace: dict[str, str], user: User | None = None, commit: bool = True) None [source]
Function to replace links that are in the translation and match the given keyword search
- save(force_insert=False, force_update=False, using=None, update_fields=None)[source]
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
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.
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)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
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.
- property title: str[source]
This function return the name of organization. Alias for link list template.
Role
- class integreat_cms.cms.models.users.role.Role(*args, **kwargs)[source]
Bases:
AbstractBaseModel
Meta information about the default Django auth group model
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) –
Name
Manage choices in
roles
staff_role (BooleanField) – Staff role. Whether or not this role is designed for staff members
Relationship fields:
- Parameters:
group (
OneToOneField
toGroup
) – Django auth group (related name:role
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- clean()[source]
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.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- english_name[source]
This returns the english name of a role which is used for logging
- Returns:
The english name of the role
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_name_display(*, field=<django.db.models.CharField: name>)[source]
Shows the label of the
name
. Seeget_FOO_display()
for more information.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<Role: Role object (id)>
. It is used for logging.- Returns:
The canonical string representation of the role
- Return type:
- group[source]
Type:
OneToOneField
toGroup
Django auth group (related name:
role
)
- id[source]
Type:
BigAutoField
Primary key: ID
- name[source]
Type:
CharField
Name
Choices:
MANAGEMENT
EDITOR
AUTHOR
EVENT_MANAGER
OBSERVER
SERVICE_TEAM
CMS_TEAM
APP_TEAM
MARKETING_TEAM
Manage choices in
roles
- refresh_from_db(using=None, fields=None)[source]
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.
- save(force_insert=False, force_update=False, using=None, update_fields=None)[source]
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
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.
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)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
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.
- staff_role[source]
Type:
BooleanField
Staff role. Whether or not this role is designed for staff members
User
Custom user model that is used instead of the default Django user model
- class integreat_cms.cms.models.users.user.CustomUserManager(*args, **kwargs)[source]
Bases:
UserManager
This manager prefetches the regions of each user because they are needed for permissions checks and the region selection anyway
- abulk_create(objs, batch_size=None, ignore_conflicts=False, update_conflicts=False, update_fields=None, unique_fields=None)[source]
- aggregate(*args, **kwargs)[source]
Return a dictionary containing the calculations (aggregation) over the current queryset.
If args is present the expression is passed as a kwarg using the Aggregate object’s default alias.
- aiterator(chunk_size=2000)[source]
An asynchronous iterator over the results from applying this QuerySet to the database.
- alias(*args, **kwargs)[source]
Return a query set with added aliases for extra data or aggregations.
- annotate(*args, **kwargs)[source]
Return a query set in which the returned objects have been annotated with extra data or aggregations.
- bulk_create(objs, batch_size=None, ignore_conflicts=False, update_conflicts=False, update_fields=None, unique_fields=None)[source]
Insert each of the instances into the database. Do not call save() on each of the instances, do not send any pre/post_save signals, and do not set the primary key attribute if it is an autoincrement field (except if features.can_return_rows_from_bulk_insert=True). Multi-table models are not supported.
- bulk_update(objs, fields, batch_size=None)[source]
Update the given fields in each of the given objects in the database.
- complex_filter(filter_obj)[source]
Return a new QuerySet instance with filter_obj added to the filters.
filter_obj can be a Q object or a dictionary of keyword lookup arguments.
This exists to support framework features such as ‘limit_choices_to’, and usually it will be more natural to use other methods.
- count()[source]
Perform a SELECT COUNT() and return the number of records as an integer.
If the QuerySet is already fully cached, return the length of the cached results set to avoid multiple SELECT COUNT(*) calls.
- create(**kwargs)[source]
Create a new object with the given kwargs, saving it to the database and returning the created object.
- dates(field_name, kind, order='ASC')[source]
Return a list of date objects representing all available dates for the given field_name, scoped to ‘kind’.
- datetimes(field_name, kind, order='ASC', tzinfo=None, is_dst=<object object>)[source]
Return a list of datetime objects representing all available datetimes for the given field_name, scoped to ‘kind’.
- deconstruct()[source]
Return a 5-tuple of the form (as_manager (True), manager_class, queryset_class, args, kwargs).
Raise a ValueError if the manager is dynamically generated.
- defer(*fields)[source]
Defer the loading of data for certain fields until they are accessed. Add the set of deferred fields to any existing set of deferred fields. The only exception to this is if None is passed in as the only parameter, in which case removal all deferrals.
- distinct(*field_names)[source]
Return a new QuerySet instance that will select only distinct results.
- exclude(*args, **kwargs)[source]
Return a new QuerySet instance with NOT (args) ANDed to the existing set.
- explain(*, format=None, **options)[source]
Runs an EXPLAIN on the SQL query this QuerySet would perform, and returns the results.
- extra(select=None, where=None, params=None, tables=None, order_by=None, select_params=None)[source]
Add extra SQL fragments to the query.
- filter(*args, **kwargs)[source]
Return a new QuerySet instance with the args ANDed to the existing set.
- get(*args, **kwargs)[source]
Perform the query and return a single object matching the given keyword arguments.
- get_or_create(defaults=None, **kwargs)[source]
Look up an object with the given kwargs, creating one if necessary. Return a tuple of (object, created), where created is a boolean specifying whether an object was created.
- get_queryset() QuerySet [source]
Get the queryset of users including the prefetched
regions
- Returns:
The queryset of users
- Return type:
QuerySet
- in_bulk(id_list=None, *, field_name='pk')[source]
Return a dictionary mapping each of the given IDs to the object with that ID. If id_list isn’t provided, evaluate the entire QuerySet.
- iterator(chunk_size=None)[source]
An iterator over the results from applying this QuerySet to the database. chunk_size must be provided for QuerySets that prefetch related objects. Otherwise, a default chunk_size of 2000 is supplied.
- latest(*fields)[source]
Return the latest object according to fields (if given) or by the model’s Meta.get_latest_by.
- make_random_password(length=10, allowed_chars='abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ23456789')[source]
Generate a random password with the given length and given allowed_chars. The default value of allowed_chars does not have “I” or “O” or letters and digits that look similar – just to avoid confusion.
- classmethod normalize_email(email)[source]
Normalize the email address by lowercasing the domain part of it.
- only(*fields)[source]
Essentially, the opposite of defer(). Only the fields passed into this method and that are not already specified as deferred are loaded immediately when the queryset is evaluated.
Return a new QuerySet instance that will prefetch the specified Many-To-One and Many-To-Many related objects when the QuerySet is evaluated.
When prefetch_related() is called more than once, append to the list of prefetch lookups. If prefetch_related(None) is called, clear the list.
- select_for_update(nowait=False, skip_locked=False, of=(), no_key=False)[source]
Return a new QuerySet instance that will select objects with a FOR UPDATE lock.
Return a new QuerySet instance that will select related objects.
If fields are specified, they must be ForeignKey fields and only those related objects are included in the selection.
If select_related(None) is called, clear the list.
- update(**kwargs)[source]
Update all elements in the current QuerySet, setting all the given fields to the appropriate values.
- update_or_create(defaults=None, **kwargs)[source]
Look up an object with the given kwargs, updating one with defaults if it exists, otherwise create a new one. Return a tuple (object, created), where created is a boolean specifying whether an object was created.
- class integreat_cms.cms.models.users.user.User(*args, **kwargs)[source]
Bases:
AbstractUser
,AbstractBaseModel
A custom User model that replaces the default Django User model
- Parameters:
id (BigAutoField) – Primary key: ID
password (CharField) – Password
last_login (DateTimeField) – Last login
is_superuser (BooleanField) – Superuser status. Designates that this account has all permissions without explicitly assigning them.
username (CharField) – Username. Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
first_name (CharField) – First name
last_name (CharField) – Last name
email (EmailField) – Email address
is_staff (BooleanField) – Staff status. Designates whether the user can log into this admin site.
is_active (BooleanField) – Active. Designates whether this account should be treated as active. Unselect this instead of deleting accounts.
date_joined (DateTimeField) – Date joined
chat_last_visited (DateTimeField) – Last chat visit date. The date and time when the user did read the chat the last time
expert_mode (BooleanField) – Experienced user. Enable this option to display additional features like XLIFF import/export, page filtering, mirrored pages, page-based permissions and status information for broken links
page_tree_tutorial_seen (BooleanField) – Page tree tutorial seen. Will be set to true once the user dismissed the page tree tutorial
distribute_sidebar_boxes (BooleanField) – Automatically distribute sidebar boxes. Enable this option to automatically distribute the boxes in the sidebar of forms to make the best use of screen space. This only affects screen resolutions where the boxes are displayed in two columns.
totp_key (CharField) – TOTP key. Will be used to generate TOTP codes
passwordless_authentication_enabled (BooleanField) – Enable passwordless authentication. Enable this option to activate the passwordless login routine for this account
webauthn_id (BinaryField) – Webauthn id
Relationship fields:
- Parameters:
organization (
ForeignKey
toOrganization
) – Organization. This allows the user to edit and publish all pages for which the organisation is registered as the responsible organisation (related name:members
)groups (
ManyToManyField
toGroup
) – Groups. The groups this user belongs to. A user will get all permissions granted to each of their groups. (related name:user_set
)user_permissions (
ManyToManyField
toPermission
) – User permissions. Specific permissions for this user. (related name:user_set
)regions (
ManyToManyField
toRegion
) – Regions. The regions to which the user has access (related name:users
)
Reverse relationships:
- Parameters:
chat_messages (Reverse
ForeignKey
fromChatMessage
) – All chat messages of this user (related name ofsender
)event_translations (Reverse
ForeignKey
fromEventTranslation
) – All event translations of this user (related name ofcreator
)page_translations (Reverse
ForeignKey
fromPageTranslation
) – All page translations of this user (related name ofcreator
)poi_translations (Reverse
ForeignKey
fromPOITranslation
) – All poi translations of this user (related name ofcreator
)externalcalendar (Reverse
ForeignKey
fromExternalCalendar
) – All external calendars of this user (related name ofcreated_by
)feedback (Reverse
ForeignKey
fromFeedback
) – All feedback of this user (related name ofread_by
)imprint_translations (Reverse
ForeignKey
fromImprintPageTranslation
) – All imprint translations of this user (related name ofcreator
)editable_pages (Reverse
ManyToManyField
fromPage
) – All editable pages of this user (related name ofauthors
)publishable_pages (Reverse
ManyToManyField
fromPage
) – All publishable pages of this user (related name ofeditors
)fido_keys (Reverse
ForeignKey
fromFidoKey
) – All fido keys of this user (related name ofuser
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- access_granted_pages(region: Region) QuerySet[Page] [source]
Get a list of all pages the user has been given explicit rights to edit
- chat_last_visited[source]
Type:
DateTimeField
Last chat visit date. The date and time when the user did read the chat the last time
- chat_messages[source]
Type: Reverse
ForeignKey
fromChatMessage
All chat messages of this user (related name of
sender
)
- check_password(raw_password)[source]
Return a boolean of whether the raw_password was correct. Handles hashing formats behind the scenes.
- clean()[source]
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.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- date_joined[source]
Type:
DateTimeField
Date joined
- distinct_region[source]
If the user is no staff member and has exactly one region, this property returns it
- Returns:
The only region of this user
- distribute_sidebar_boxes[source]
Type:
BooleanField
Automatically distribute sidebar boxes. Enable this option to automatically distribute the boxes in the sidebar of forms to make the best use of screen space. This only affects screen resolutions where the boxes are displayed in two columns.
- editable_pages[source]
Type: Reverse
ManyToManyField
fromPage
All editable pages of this user (related name of
authors
)
- email[source]
Type:
EmailField
Email address
- event_translations[source]
Type: Reverse
ForeignKey
fromEventTranslation
All event translations of this user (related name of
creator
)
- expert_mode[source]
Type:
BooleanField
Experienced user. Enable this option to display additional features like XLIFF import/export, page filtering, mirrored pages, page-based permissions and status information for broken links
- externalcalendar_set[source]
Type: Reverse
ForeignKey
fromExternalCalendar
All external calendars of this user (related name of
created_by
)
- feedback[source]
Type: Reverse
ForeignKey
fromFeedback
All feedback of this user (related name of
read_by
)
- fido_keys[source]
Type: Reverse
ForeignKey
fromFidoKey
All fido keys of this user (related name of
user
)
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- property full_user_name: str[source]
Return the full name of the user. If either the first or the last name are present, return them, otherwise return the username.
- Returns:
The full name of the user
- get_group_permissions(obj=None)[source]
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.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_chat_last_visited(*, field=<django.db.models.DateTimeField: chat_last_visited>, is_next=True, **kwargs)[source]
Finds next instance based on
chat_last_visited
. Seeget_next_by_FOO()
for more information.
- get_next_by_date_joined(*, field=<django.db.models.DateTimeField: date_joined>, is_next=True, **kwargs)[source]
Finds next instance based on
date_joined
. Seeget_next_by_FOO()
for more information.
- get_previous_by_chat_last_visited(*, field=<django.db.models.DateTimeField: chat_last_visited>, is_next=False, **kwargs)[source]
Finds previous instance based on
chat_last_visited
. Seeget_previous_by_FOO()
for more information.
- get_previous_by_date_joined(*, field=<django.db.models.DateTimeField: date_joined>, is_next=False, **kwargs)[source]
Finds previous instance based on
date_joined
. Seeget_previous_by_FOO()
for more information.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<User: User object (id)>
. It is used for logging.- Returns:
The canonical string representation of the user
- Return type:
- get_user_permissions(obj=None)[source]
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.
- groups[source]
Type:
ManyToManyField
toGroup
Groups. The groups this user belongs to. A user will get all permissions granted to each of their groups. (related name:
user_set
)
- has_module_perms(app_label)[source]
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)[source]
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)[source]
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.
- has_totp[source]
If the user has totp configured
- Returns:
True if the user has totp configured, False otherwise
- has_usable_password()[source]
Return False if set_unusable_password() has been called for this user.
- id[source]
Type:
BigAutoField
Primary key: ID
- imprint_translations[source]
Type: Reverse
ForeignKey
fromImprintPageTranslation
All imprint translations of this user (related name of
creator
)
- is_active[source]
Type:
BooleanField
Active. Designates whether this account should be treated as active. Unselect this instead of deleting accounts.
- property is_anonymous[source]
Always return False. This is a way of comparing User objects to anonymous users.
- property is_authenticated[source]
Always return True. This is a way to tell if the user has been authenticated in templates.
- is_staff[source]
Type:
BooleanField
Staff status. Designates whether the user can log into this admin site.
- is_superuser[source]
Type:
BooleanField
Superuser status. Designates that this account has all permissions without explicitly assigning them.
- last_login[source]
Type:
DateTimeField
Last login
- objects = <integreat_cms.cms.models.users.user.CustomUserManager object>[source]
Django manager to access the ORM Use
User.objects.all()
to fetch all objects.Custom model manager for user objects
- organization[source]
Type:
ForeignKey
toOrganization
Organization. This allows the user to edit and publish all pages for which the organisation is registered as the responsible organisation (related name:
members
)
- organization_id[source]
Internal field, use
organization
instead.
- page_translations[source]
Type: Reverse
ForeignKey
fromPageTranslation
All page translations of this user (related name of
creator
)
- page_tree_tutorial_seen[source]
Type:
BooleanField
Page tree tutorial seen. Will be set to true once the user dismissed the page tree tutorial
- passwordless_authentication_enabled[source]
Type:
BooleanField
Enable passwordless authentication. Enable this option to activate the passwordless login routine for this account
- poi_translations[source]
Type: Reverse
ForeignKey
fromPOITranslation
All poi translations of this user (related name of
creator
)
- publishable_pages[source]
Type: Reverse
ManyToManyField
fromPage
All publishable pages of this user (related name of
editors
)
- refresh_from_db(using=None, fields=None)[source]
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.
- regions[source]
Type:
ManyToManyField
toRegion
Regions. The regions to which the user has access (related name:
users
)
- save(*args, **kwargs)[source]
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
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.
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)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
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.
- property unread_chat_messages: QuerySet[ChatMessage][source]
Return all unread messages of this user
- Returns:
The unread messages of this user
- update_chat_last_visited() datetime [source]
Update the
chat_last_visited
to the current time- Returns:
the previous
chat_last_visited
value- Return type:
datetime
- user_permissions[source]
Type:
ManyToManyField
toPermission
User permissions. Specific permissions for this user. (related name:
user_set
)
- username[source]
Type:
CharField
Username. Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.
- validate_unique(exclude=None)[source]
Check unique constraints on the model and raise ValidationError if any failed.
- webauthn_id[source]
Type:
BinaryField
Webauthn id
User Fido Key
- class integreat_cms.cms.models.users.user_fido_key.FidoKey(*args, **kwargs)[source]
Bases:
AbstractBaseModel
Data model representing a user’s FIDO key
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) – Key name
key_id (BinaryField) – WebAuthn ID
public_key (BinaryField) – Multi-factor-authentication public key
sign_count (IntegerField) – Sign count. Token to prevent replay attacks.
last_usage (DateTimeField) – Last date of use
created_at (DateTimeField) – Creation date
Relationship fields:
- Parameters:
user (
ForeignKey
toUser
) – User (related name:fido_keys
)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- clean()[source]
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.
- clean_fields(exclude=None)[source]
Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.
- created_at[source]
Type:
DateTimeField
Creation date
- full_clean(exclude=None, validate_unique=True, validate_constraints=True)[source]
Call clean_fields(), clean(), validate_unique(), and validate_constraints() on the model. Raise a ValidationError for any errors that occur.
- classmethod get_model_name_plural() str [source]
Get the plural representation of this model name
- Returns:
The plural model name
- Return type:
- get_next_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=True, **kwargs)[source]
Finds next instance based on
created_at
. Seeget_next_by_FOO()
for more information.
- get_previous_by_created_at(*, field=<django.db.models.DateTimeField: created_at>, is_next=False, **kwargs)[source]
Finds previous instance based on
created_at
. Seeget_previous_by_FOO()
for more information.
- get_repr() str [source]
This overwrites the default Django
__repr__()
method which would return<UserMfaKey: UserMfaKey object (id)>
. It is used for logging.- Returns:
The canonical string representation of the user MFA
- Return type:
- id[source]
Type:
BigAutoField
Primary key: ID
- key_id[source]
Type:
BinaryField
WebAuthn ID
- last_usage[source]
Type:
DateTimeField
Last date of use
- public_key[source]
Type:
BinaryField
Multi-factor-authentication public key
- refresh_from_db(using=None, fields=None)[source]
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.
- save(force_insert=False, force_update=False, using=None, update_fields=None)[source]
Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
- save_base(raw=False, force_insert=False, force_update=False, using=None, update_fields=None)[source]
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.
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)[source]
Return the value of the field name for this instance. If the field is a foreign key, return the id value instead of the object. If there’s no Field object with this name on the model, return the model attribute’s value.
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.
- sign_count[source]
Type:
IntegerField
Sign count. Token to prevent replay attacks.
- user[source]
Type:
ForeignKey
toUser
User (related name:
fido_keys
)