CMS

Admin

Debug lists and forms for all models

Apps

class integreat_cms.cms.apps.CmsConfig(app_name, app_module)[source]

Bases: AppConfig

This class represents the Django-configuration of the backend.

See django.apps.AppConfig for more information.

Parameters:

name – The name of the app

name: Final[str] = 'integreat_cms.cms'[source]

Full Python path to the application

ready() None[source]

Monkeypatch the checking of internal URLs

Return type:

None

verbose_name: Final[Promise] = 'CMS'[source]

Human-readable name for the application

Auth

class integreat_cms.cms.auth.WPBCryptPasswordHasher[source]

Bases: BCryptSHA256PasswordHasher

A PHP (and WordPress) compatible BCrypt password hasher that supports hashes with $2y$10$. See https://www.php.net/manual/en/function.password-hash.php. For PHP style hashes only verification is supported.

verify(password: str, encoded: str) bool[source]

Validate that entered password matches stored hash

Parameters:
  • password (str) – the plain text password

  • encoded (str) – the hashed and salted password, i.e. from database

Returns:

entered password matches the hash

Return type:

bool

Decorators

Django view decorators can be used to restrict the execution of a view function on certain conditions.

For more information, see View decorators.

integreat_cms.cms.decorators.modify_mfa_authenticated(function: Callable) Callable[source]

This decorator can be used to make sure a user can only modify his 2FA settings when he has a valid 2FA session.

Parameters:

function (Callable) – The view function which should be protected

Returns:

The decorated function

Return type:

Callable

integreat_cms.cms.decorators.permission_required(permission: str) Callable[source]

Decorator for views that checks whether a user has a particular permission enabled. If not, the PermissionDenied exception is raised.

Parameters:

permission (str) – The required permission

Returns:

The decorated function

Return type:

Callable

integreat_cms.cms.decorators.region_permission_required(function: Callable) Callable[source]

This decorator can be used to make sure a view can only be retrieved by users of the requested region.

Parameters:

function (Callable) – The view function which should be protected

Returns:

The decorated function

Return type:

Callable

Linklists

class integreat_cms.cms.linklists.ActiveLanguageLinklist[source]

Bases: Linklist

Base class for content translation link lists

classmethod filter_callable(objects: QuerySet) QuerySet[source]

Get only translations in active languages

Parameters:

objects (QuerySet) – Objects to be filtered

Returns:

Objects that passed the filter

Return type:

QuerySet

class integreat_cms.cms.linklists.EventTranslationLinklist[source]

Bases: NonArchivedLinkList

Class for selecting the EventTranslation model for link checks

classmethod filter_callable(objects: QuerySet) QuerySet[source]

Get only translations of upcoming events in active languages

Parameters:

objects (QuerySet) – Objects to be filtered

Returns:

Objects that passed the filter

Return type:

QuerySet

model[source]

alias of EventTranslation

class integreat_cms.cms.linklists.NonArchivedLinkList[source]

Bases: ActiveLanguageLinklist

Class for excluding archived events and locations

classmethod filter_callable(objects: QuerySet) QuerySet[source]

Get only latest translations for non-archived events/locations in active languages

Parameters:

objects (QuerySet) – Objects to be filtered

Returns:

Objects that passed the filter

Return type:

QuerySet

class integreat_cms.cms.linklists.POITranslationLinklist[source]

Bases: NonArchivedLinkList

Class for selecting the POITranslation model for link checks

model[source]

alias of POITranslation

class integreat_cms.cms.linklists.PageTranslationLinklist[source]

Bases: ActiveLanguageLinklist

Class for selecting the PageTranslation model for link checks

classmethod filter_callable(objects: QuerySet) QuerySet[source]

Get only latest versions for non-archived pages in active languages

Parameters:

objects (QuerySet) – Objects to be filtered

Returns:

Objects that passed the filter

Return type:

QuerySet

model[source]

alias of PageTranslation

Rules

We use django-rules to add custom permissions for specific pages.

For a given user and page, the following permissions are added:

See the project’s README to learn more.

integreat_cms.cms.rules.is_page_author(user: User, page: Page | None) bool[source]

This predicate checks whether the given user is one of the authors of the given page.

Parameters:
  • user (User) – The user who’s permission should be checked

  • page (Page | None) – The requested page

Returns:

Whether or not user is an author of page

Return type:

bool

integreat_cms.cms.rules.is_page_editor(user: User, page: Page | None) bool[source]

This predicate checks whether the given user is one of the editors of the given page.

Parameters:
  • user (User) – The user who’s permission should be checked

  • page (Page | None) – The requested page

Returns:

Whether or not user is an editor of page

Return type:

bool

integreat_cms.cms.rules.can_edit_all_pages(user: User, page: Page | None) bool[source]

This predicate checks whether the given user can edit all pages.

Parameters:
  • user (User) – The user who’s permission should be checked

  • page (Page | None) – The page parameter is used for the region check

Returns:

Whether or not user can edit all pages

Return type:

bool

integreat_cms.cms.rules.can_publish_all_pages(user: User, page: Page | None) bool[source]

This predicate checks whether the given user can publish all pages.

Parameters:
  • user (User) – The user who’s permission should be checked

  • page (Page | None) – The page parameter is used for the region check

Returns:

Whether or not user can publish all pages

Return type:

bool

integreat_cms.cms.rules.is_in_responsible_organization(user: User, page: Page | None) bool[source]

This predicate checks whether the given user is a member of the page’s responsible organization.

Parameters:
  • user (User) – The user who’s permission should be checked

  • page (Page | None) – The requested page

Returns:

Whether or not user is a member of page.organization

Return type:

bool

integreat_cms.cms.rules.can_delete_chat_message(user: User, chat_message: ChatMessage) bool[source]

This predicate checks whether the given user can delete a given chat message

Parameters:
  • user (User) – The user who’s permission should be checked

  • chat_message (ChatMessage) – The requested chat message

Returns:

Whether or not user is allowed to delete chat_message

Return type:

bool