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:

Relationship fields:

Parameters:

Reverse relationships:

Parameters:
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:

str

property num_members: int[source]
Returns:

the current number of members of an organization object

property num_pages: 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:

Relationship fields:

Parameters:

group (OneToOneField to Group) – 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

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:

str

name[source]

Type: CharField

Name

Choices:

  • MANAGEMENT

  • EDITOR

  • AUTHOR

  • EVENT_MANAGER

  • OBSERVER

  • SERVICE_TEAM

  • CMS_TEAM

  • APP_TEAM

  • MARKETING_TEAM

Manage choices in roles

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

Relationship fields:

Parameters:
  • organization (ForeignKey to Organization) – 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 to Group) – 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 to Permission) – User permissions. Specific permissions for this user. (related name: user_set)

  • regions (ManyToManyField to Region) – Regions. The regions to which the user has access (related name: users)

Reverse relationships:

Parameters:
exception DoesNotExist[source]

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned[source]

Bases: MultipleObjectsReturned

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:

str

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:

Relationship fields:

Parameters:

user (ForeignKey to User) – User (related name: fido_keys)

exception DoesNotExist[source]

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned[source]

Bases: MultipleObjectsReturned

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:

str