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:
AbstractBaseModelData 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 (
ForeignKeytoMediaFile) – Logo (related name:icon_organizations)region (
ForeignKeytoRegion) – Region (related name:organizations)links (
GenericRelationtoLink) – Links (related name:organization)
Reverse relationships:
- Parameters:
pois (Reverse
ForeignKeyfromPOI) – All pois of this organization (related name oforganization)pages (Reverse
ForeignKeyfromPage) – All pages of this organization (related name oforganization)members (Reverse
ForeignKeyfromUser) – All members of this organization (related name oforganization)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- backend_edit_link[source]
This function returns the absolute url to the edit form of this region
- Returns:
The url
- 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:
- property num_contents: int[source]
- Returns:
the current number of maintained pages of an organization object
- 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
- classmethod search(region: Region, query: str) QuerySet[source]
Searches for all organizations which match the given query in their name. :param query: The query string used for filtering the organizations :return: A query for all matching objects
Role
- class integreat_cms.cms.models.users.role.Role(*args, **kwargs)[source]
Bases:
AbstractBaseModelMeta information about the default Django auth group model
- Parameters:
id (BigAutoField) – Primary key: ID
name (CharField) –
Name
Manage choices in
rolesstaff_role (BooleanField) – Staff role. Whether or not this role is designed for staff members
Relationship fields:
- Parameters:
group (
OneToOneFieldtoGroup) – Django auth group (related name:role)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned
- english_name[source]
This returns the english name of a role which is used for logging
- Returns:
The english name of the role
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:
UserManagerThis manager prefetches the regions of each user because they are needed for permissions checks and the region selection anyway
- get_queryset() QuerySet[source]
Get the queryset of users including the prefetched
regions- Returns:
The queryset of users
- Return type:
QuerySet
- class integreat_cms.cms.models.users.user.User(*args, **kwargs)[source]
Bases:
AbstractUser,AbstractBaseModelA 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
has_seen_page_tree_tutorial (BooleanField) – Page tree tutorial seen. Has seen tutorial for page tree
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 (
ForeignKeytoOrganization) – 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 (
ManyToManyFieldtoGroup) – 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 (
ManyToManyFieldtoPermission) – User permissions. Specific permissions for this user. (related name:user_set)regions (
ManyToManyFieldtoRegion) – Regions. The regions to which the user has access (related name:users)
Reverse relationships:
- Parameters:
chat_messages (Reverse
ForeignKeyfromChatMessage) – All chat messages of this user (related name ofsender)event_translations (Reverse
ForeignKeyfromEventTranslation) – All event translations of this user (related name ofcreator)page_translations (Reverse
ForeignKeyfromPageTranslation) – All page translations of this user (related name ofcreator)poi_translations (Reverse
ForeignKeyfromPOITranslation) – All poi translations of this user (related name ofcreator)externalcalendar (Reverse
ForeignKeyfromExternalCalendar) – All external calendars of this user (related name ofcreated_by)feedback (Reverse
ForeignKeyfromFeedback) – All feedback of this user (related name ofread_by)imprint_translations (Reverse
ForeignKeyfromImprintPageTranslation) – All imprint translations of this user (related name ofcreator)editable_pages (Reverse
ManyToManyFieldfromPage) – All editable pages of this user (related name ofauthors)publishable_pages (Reverse
ManyToManyFieldfromPage) – All publishable pages of this user (related name ofeditors)fido_keys (Reverse
ForeignKeyfromFidoKey) – 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
- 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
- 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_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:
- has_totp[source]
If the user has totp configured
- Returns:
True if the user has totp configured, False otherwise
- 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
- role[source]
We refer to Django user groups as roles.
- Returns:
The role of this user
- 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_visitedto the current time- Returns:
the previous
chat_last_visitedvalue- Return type:
datetime
User Fido Key
- class integreat_cms.cms.models.users.user_fido_key.FidoKey(*args, **kwargs)[source]
Bases:
AbstractBaseModelData 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 (
ForeignKeytoUser) – User (related name:fido_keys)
- exception DoesNotExist[source]
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned[source]
Bases:
MultipleObjectsReturned