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
- 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
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
- 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:
UserManager
This 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
,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
)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
)event_translations (Reverse
ForeignKey
fromEventTranslation
) – All event translations of this user (related name ofcreator
)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
)page_translations (Reverse
ForeignKey
fromPageTranslation
) – All page 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
- 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_visited
to the current time- Returns:
the previous
chat_last_visited
value- Return type:
datetime
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