Pages

This package contains all views related to pages

Page Actions

This module contains view actions related to pages.

integreat_cms.cms.views.pages.page_actions.archive_page(request: HttpRequest, page_id: int, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Archive page object

Parameters:
  • request (HttpRequest) – The current request

  • page_id (int) – The id of the page which should be archived

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

A redirection to the PageTreeView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pages.page_actions.cancel_translation_process_ajax(request: HttpRequest, region_slug: str, language_slug: str, page_id: int) JsonResponse[source]

This view is called for manually unsetting the translation process

Parameters:
  • request (HttpRequest) – ajax request

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

  • page_id (int) – The id of the requested page

Returns:

on success returns language of updated translation

Return type:

JsonResponse

integreat_cms.cms.views.pages.page_actions.delete_page(request: HttpRequest, page_id: int, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Delete page object

Parameters:
  • request (HttpRequest) – The current request

  • page_id (int) – The id of the page which should be deleted

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Returns:

A redirection to the PageTreeView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pages.page_actions.expand_page_translation_id(request: HttpRequest, short_url_id: int) HttpResponseRedirect[source]

Searches for a page translation with corresponding ID and redirects browser to web app

Parameters:
  • request (HttpRequest) – The current request

  • short_url_id (int) – The id of the requested page

Returns:

A redirection to WEBAPP_URL

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pages.page_actions.get_page_content_ajax(request: HttpRequest, region_slug: str, language_slug: str, page_id: int) JsonResponse[source]

Get content of a page translation based on language slug

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

  • page_id (int) – The id of the page which should be viewed

Raises:

Http404 – HTTP status 404 if page translation does not exist

Returns:

Page translation content as a JSON.

Return type:

JsonResponse

integreat_cms.cms.views.pages.page_actions.get_page_order_table_ajax(request: HttpRequest, region_slug: str, parent_id: int | None = None, page_id: int | None = None) HttpResponse[source]

Retrieve the order table for a given page and a given parent page. This is used in the page form to change the order of a page relative to its siblings.

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

  • parent_id (int | None) – The id of the parent page to which the order table should be returned

  • page_id (int | None) – The id of the page of the current page form

Returns:

The rendered page order table

Return type:

HttpResponse

integreat_cms.cms.views.pages.page_actions.move_page(request: HttpRequest, region_slug: str, language_slug: str, page_id: int, target_id: int, position: str) HttpResponseRedirect[source]

Move a page object in the page tree

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

  • page_id (int) – The id of the page which should be moved

  • target_id (int) – The id of the page which determines the new position

  • position (str) – The new position of the page relative to the target (choices: position)

Returns:

A redirection to the PageTreeView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pages.page_actions.preview_page_ajax(request: HttpRequest, page_id: int, region_slug: str, language_slug: str) JsonResponse[source]

Preview page object

Parameters:
  • request (HttpRequest) – The current request

  • page_id (int) – The id of the page which should be viewed

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Raises:

Http404 – HTTP status 404 if page translation does not exist

Returns:

Significant page data as a JSON.

Return type:

JsonResponse

integreat_cms.cms.views.pages.page_actions.refresh_date(request: HttpRequest, page_id: int, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Refresh the date for up-to-date translations of a corresponding page

Parameters:
  • request (HttpRequest) – The current request

  • page_id (int) – The id of the page of the current page form

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Raises:

PermissionDenied – If the user does not have the permission to refresh page dates

Returns:

A redirection to the PageFormView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pages.page_actions.render_mirrored_page_field(request: HttpRequest, region_slug: str, language_slug: str) HttpResponse[source]

Retrieve the rendered mirrored page field template

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Returns:

The rendered mirrored page field

Return type:

HttpResponse

integreat_cms.cms.views.pages.page_actions.restore_page(request: HttpRequest, page_id: int, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Restore page object (set archived=False)

Parameters:
  • request (HttpRequest) – The current request

  • page_id (int) – The id of the page which should be restored

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

A redirection to the PageTreeView

Return type:

HttpResponseRedirect

integreat_cms.cms.views.pages.page_actions.upload_xliff(request: HttpRequest, region_slug: str, language_slug: str) HttpResponseRedirect[source]

Upload and import an XLIFF file

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Returns:

A redirection to the PageTreeView

Return type:

HttpResponseRedirect

Page Bulk Actions

class integreat_cms.cms.views.pages.page_bulk_actions.ExportMultiLanguageXliffView(**kwargs)[source]

Bases: PageBulkActionMixin, BulkActionView

Bulk action for generating XLIFF files for translations in multiple languages.

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request, *args, **kwargs)[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required() tuple[str][source]

Override this method to override the permission_required attribute.

Returns:

The permissions that are required for views inheriting from this Mixin

Return type:

tuple[str]

get_queryset() Any[source]

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

handle_no_permission()[source]
has_permission()[source]

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

http_method_not_allowed(request, *args, **kwargs)[source]
login_url = None[source]
model[source]

alias of Page

options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Function for handling a XLIFF export request for pages and multiple languages. The pages get extracted from request.GET attribute and the request is forwarded to pages_to_xliff_file()

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The redirect

Return type:

HttpResponse

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = False[source]

Whether the view requires change permissions

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

url = None[source]
view_is_async = False[source]
class integreat_cms.cms.views.pages.page_bulk_actions.ExportXliffView(**kwargs)[source]

Bases: PageBulkActionMixin, BulkActionView

Bulk action for generating XLIFF files for translations

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request, *args, **kwargs)[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required() tuple[str][source]

Override this method to override the permission_required attribute.

Returns:

The permissions that are required for views inheriting from this Mixin

Return type:

tuple[str]

get_queryset() Any[source]

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

handle_no_permission()[source]
has_permission()[source]

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

http_method_not_allowed(request, *args, **kwargs)[source]
login_url = None[source]
model[source]

alias of Page

only_public = False[source]

Whether only public translation should be exported

options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Function for handling a XLIFF export request for pages. The pages get extracted from request.GET attribute and the request is forwarded to pages_to_xliff_file()

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The redirect

Return type:

HttpResponseRedirect

prefetch_public_translations: bool = False[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = False[source]

Whether the view requires change permissions

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

url = None[source]
view_is_async = False[source]
class integreat_cms.cms.views.pages.page_bulk_actions.GeneratePdfView(**kwargs)[source]

Bases: PageBulkActionMixin, BulkActionView

Bulk action for generating a PDF document of the content

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

allow_empty = True[source]
classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

context_object_name = None[source]
delete(request, *args, **kwargs)[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request, *args, **kwargs)[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_login_url()[source]

Override this method to override the login_url attribute.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required() tuple[str][source]

Override this method to override the permission_required attribute.

Returns:

The permissions that are required for views inheriting from this Mixin

Return type:

tuple[str]

get_queryset() Any[source]

Get the queryset of selected items for this bulk action

Raises:

Http404 – HTTP status 404 if no objects with the given ids exist

Returns:

The QuerySet of the filtered links

Return type:

Any

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_redirect_url(*args: Any, **kwargs: Any) str[source]

Retrieve url for redirection

Parameters:
  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

url to redirect to

Return type:

str

handle_no_permission()[source]
has_permission()[source]

Override this method to customize the way permissions are checked.

head(request, *args, **kwargs)[source]
http_method_names: list[str] = ['post'][source]

The list of HTTP method names that this view will accept. The bulk action form uses only POST as submission method.

http_method_not_allowed(request, *args, **kwargs)[source]
login_url = None[source]
model[source]

alias of Page

options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

patch(request, *args, **kwargs)[source]
pattern_name = None[source]
permanent = False[source]
permission_denied_message = ''[source]
permission_required = None[source]
post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Apply the bulk action on every item in the queryset and redirect

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The redirect

Return type:

HttpResponseRedirect

prefetch_public_translations: bool = True[source]

Whether the public translation objects should be prefetched

prefetch_translations: bool = False[source]

Whether the translation objects should be prefetched

put(request, *args, **kwargs)[source]
query_string = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
require_change_permission: bool = False[source]

Whether the view requires change permissions

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

url = None[source]
view_is_async = False[source]
class integreat_cms.cms.views.pages.page_bulk_actions.PageBulkActionMixin[source]

Bases: MultipleObjectMixin

Mixin for page bulk actions

__init__()[source]
allow_empty = True[source]
context_object_name = None[source]
extra_context = None[source]
get_allow_empty()[source]

Return True if the view should display empty lists and False if a 404 should be raised instead.

get_context_data(*, object_list=None, **kwargs)[source]

Get the context for this view.

get_context_object_name(object_list)[source]

Get the name of the item to be used in the context.

get_ordering()[source]

Return the field or fields to use for ordering the queryset.

get_paginate_by(queryset)[source]

Get the number of items to paginate by, or None for no pagination.

get_paginate_orphans()[source]

Return the maximum number of orphans extend the last page by when paginating.

get_paginator(queryset, per_page, orphans=0, allow_empty_first_page=True, **kwargs)[source]

Return an instance of the paginator for this view.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model[source]

The model of this BulkActionView

Parameters:

Relationship fields:

Parameters:
  • parent (ForeignKey to Page) – Parent page (related name: children)

  • region (ForeignKey to Region) – Region (related name: pages)

  • icon (ForeignKey to MediaFile) – Icon (related name: pages)

  • mirrored_page (ForeignKey to Page) – Mirrored page. If the page embeds live content from another page, it is referenced here. (related name: mirroring_pages)

  • organization (ForeignKey to Organization) – Responsible organization. This allows all members of the organization to edit and publish this page. (related name: pages)

  • authors (ManyToManyField to User) – Authors. A list of users who have the permission to edit this specific page. Only has effect if these users do not have the permission to edit pages anyway. (related name: editable_pages)

  • editors (ManyToManyField to User) – Editors. A list of users who have the permission to publish this specific page. Only has effect if these users do not have the permission to publish pages anyway. (related name: publishable_pages)

  • embedded_offers (ManyToManyField to OfferTemplate) – Page based offer. Select an offer provider whose offers should be displayed on this page. (related name: pages)

Reverse relationships:

Parameters:

alias of Page

ordering = None[source]
page_kwarg = 'page'[source]
paginate_by = None[source]
paginate_orphans = 0[source]
paginate_queryset(queryset, page_size)[source]

Paginate the queryset, if needed.

paginator_class[source]

alias of Paginator

queryset = None[source]

Page Context Mixin

class integreat_cms.cms.views.pages.page_context_mixin.PageContextMixin[source]

Bases: ContextMixin

This mixin provides extra context for page views

__init__()[source]
extra_context = None[source]
get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

Page Form View

class integreat_cms.cms.views.pages.page_form_view.PageFormView(**kwargs)[source]

Bases: TemplateView, PageContextMixin, MediaContextMixin, ContentEditLockMixin

View for the page form and page translation form

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

back_url_name: str | None = 'pages'[source]

The url name of the view to show if the user decides to go back (see ContentEditLockMixin)

content_type = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = {'current_menu_item': 'new_page'}[source]

The context dict passed to the template (see ContextMixin)

get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Render PageForm and PageTranslationForm

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

The rendered template response

Return type:

HttpResponse

get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

static get_side_by_side_language_options(region: Region, language: Language, page: Page | None) list[dict[str, Any]][source]

This is a helper function to generate the side-by-side language options for both the get and post requests.

Parameters:
  • region (Region) – The current region

  • language (Language) – The current language

  • page (Page | None) – The current page

Returns:

The list of language options, each represented by a dict

Return type:

list[dict[str, Any]]

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Submit PageForm and PageTranslationForm and save Page and PageTranslation objects. Forms containing images/files need to be additionally instantiated with the FILES attribute of request objects, see File Uploads

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

The rendered template response

Return type:

HttpResponseRedirect

render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class[source]

alias of TemplateResponse

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

template_engine = None[source]
template_name = 'pages/page_form.html'[source]

The template to render (see TemplateResponseMixin)

view_is_async = False[source]

Page Permission Actions

class integreat_cms.cms.views.pages.page_permission_actions.AbstractPagePermission(permission: str)[source]

Bases: ABC

An abstract class to handle page permissions

Parameters:

permission (str) –

__init__(permission: str)[source]
Parameters:

permission (str) –

build_grant_message(user: User, page: Page) PermissionMessage[source]

Build the success message when granting a permission

Parameters:
  • user (User) – user that is granted a permission

  • page (Page) – page the user is granted the permission for

Returns:

message with level_tag

Return type:

PermissionMessage

build_revoke_message(user: User, page: Page) PermissionMessage[source]

Build the response message after revoking

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

permission message

Return type:

PermissionMessage

grant_permission(user: User, page: Page) PermissionMessage[source]

Grant the permission

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

Response message

Return type:

PermissionMessage

abstract property grant_success_message: str[source]

Success message for granting a permission

Returns:

success message

revoke_permission(user: User, page: Page) PermissionMessage[source]

Revoke the permission

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

Response message

Return type:

PermissionMessage

abstract property revoke_success_message: str[source]

Success message for revoking a permission

Returns:

success message

abstract property revoke_with_no_effect_success_message: str[source]

Success message for granting a permission without effect

Returns:

success message

abstract save_grant_permission(user: User, page: Page) None[source]

Grant the permission and save changes

Parameters:
  • user (User) – User the permission should be changed for

  • page (Page) – Page the permission should be changed for

Return type:

None

abstract save_revoke_permission(user: User, page: Page) None[source]

Revoke the permission and save changes

Parameters:
  • user (User) – User the permission should be changed for

  • page (Page) – Page the permission should be changed for

Return type:

None

class integreat_cms.cms.views.pages.page_permission_actions.EditPagePermission[source]

Bases: AbstractPagePermission

Implementation of AbstractPagePermission for editing page permissions

__init__() None[source]
Return type:

None

build_grant_message(user: User, page: Page) PermissionMessage[source]

Build the success message when granting a permission

Parameters:
  • user (User) – user that is granted a permission

  • page (Page) – page the user is granted the permission for

Returns:

message with level_tag

Return type:

PermissionMessage

build_revoke_message(user: User, page: Page) PermissionMessage[source]

Build the response message after revoking

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

permission message

Return type:

PermissionMessage

grant_permission(user: User, page: Page) PermissionMessage[source]

Grant the permission

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

Response message

Return type:

PermissionMessage

grant_success_message = 'Success: The user "{}" can now edit this page.'[source]
revoke_permission(user: User, page: Page) PermissionMessage[source]

Revoke the permission

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

Response message

Return type:

PermissionMessage

revoke_success_message = 'Success: The user "{}" cannot edit this page anymore.'[source]
revoke_with_no_effect_success_message = 'Information: The user "{}" has been removed from the authors of this page, but has the implicit permission to edit this page anyway.'[source]
save_grant_permission(user: User, page: Page) None[source]

Grant the permission and save changes

Parameters:
  • user (User) – User the permission should be changed for

  • page (Page) – Page the permission should be changed for

Return type:

None

save_revoke_permission(user: User, page: Page) None[source]

Revoke the permission and save changes

Parameters:
  • user (User) – User the permission should be changed for

  • page (Page) – Page the permission should be changed for

Return type:

None

class integreat_cms.cms.views.pages.page_permission_actions.MessageLevel(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: StrEnum

Enum for different level tags of a message

ERROR = 'error'[source]
INFO = 'info'[source]
SUCCESS = 'success'[source]
WARNING = 'warning'[source]
__init__(*args, **kwds)[source]
capitalize()[source]

Return a capitalized version of the string.

More specifically, make the first character have upper case and the rest lower case.

casefold()[source]

Return a version of the string suitable for caseless comparisons.

center(width, fillchar=' ', /)[source]

Return a centered string of length width.

Padding is done using the specified fill character (default is a space).

count(sub[, start[, end]]) int[source]

Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.

encode(encoding='utf-8', errors='strict')[source]

Encode the string using the codec registered for encoding.

encoding

The encoding in which to encode the string.

errors

The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.

endswith(suffix[, start[, end]]) bool[source]

Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.

expandtabs(tabsize=8)[source]

Return a copy where all tab characters are expanded using spaces.

If tabsize is not given, a tab size of 8 characters is assumed.

find(sub[, start[, end]]) int[source]

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

format(*args, **kwargs) str[source]

Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).

format_map(mapping) str[source]

Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).

index(sub[, start[, end]]) int[source]

Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

isalnum()[source]

Return True if the string is an alpha-numeric string, False otherwise.

A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.

isalpha()[source]

Return True if the string is an alphabetic string, False otherwise.

A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

isascii()[source]

Return True if all characters in the string are ASCII, False otherwise.

ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.

isdecimal()[source]

Return True if the string is a decimal string, False otherwise.

A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.

isdigit()[source]

Return True if the string is a digit string, False otherwise.

A string is a digit string if all characters in the string are digits and there is at least one character in the string.

isidentifier()[source]

Return True if the string is a valid Python identifier, False otherwise.

Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.

islower()[source]

Return True if the string is a lowercase string, False otherwise.

A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.

isnumeric()[source]

Return True if the string is a numeric string, False otherwise.

A string is numeric if all characters in the string are numeric and there is at least one character in the string.

isprintable()[source]

Return True if the string is printable, False otherwise.

A string is printable if all of its characters are considered printable in repr() or if it is empty.

isspace()[source]

Return True if the string is a whitespace string, False otherwise.

A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.

istitle()[source]

Return True if the string is a title-cased string, False otherwise.

In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.

isupper()[source]

Return True if the string is an uppercase string, False otherwise.

A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.

join(iterable, /)[source]

Concatenate any number of strings.

The string whose method is called is inserted in between each given string. The result is returned as a new string.

Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’

ljust(width, fillchar=' ', /)[source]

Return a left-justified string of length width.

Padding is done using the specified fill character (default is a space).

lower()[source]

Return a copy of the string converted to lowercase.

lstrip(chars=None, /)[source]

Return a copy of the string with leading whitespace removed.

If chars is given and not None, remove characters in chars instead.

static maketrans()[source]

Return a translation table usable for str.translate().

If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.

partition(sep, /)[source]

Partition the string into three parts using the given separator.

This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing the original string and two empty strings.

removeprefix(prefix, /)[source]

Return a str with the given prefix string removed if present.

If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.

removesuffix(suffix, /)[source]

Return a str with the given suffix string removed if present.

If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.

replace(old, new, count=-1, /)[source]

Return a copy with all occurrences of substring old replaced by new.

count

Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.

If the optional argument count is given, only the first count occurrences are replaced.

rfind(sub[, start[, end]]) int[source]

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Return -1 on failure.

rindex(sub[, start[, end]]) int[source]

Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.

Raises ValueError when the substring is not found.

rjust(width, fillchar=' ', /)[source]

Return a right-justified string of length width.

Padding is done using the specified fill character (default is a space).

rpartition(sep, /)[source]

Partition the string into three parts using the given separator.

This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.

If the separator is not found, returns a 3-tuple containing two empty strings and the original string.

rsplit(sep=None, maxsplit=-1)[source]

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits (starting from the left). -1 (the default value) means no limit.

Splitting starts at the end of the string and works to the front.

rstrip(chars=None, /)[source]

Return a copy of the string with trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

split(sep=None, maxsplit=-1)[source]

Return a list of the substrings in the string, using sep as the separator string.

sep

The separator used to split the string.

When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.

maxsplit

Maximum number of splits (starting from the left). -1 (the default value) means no limit.

Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.

splitlines(keepends=False)[source]

Return a list of the lines in the string, breaking at line boundaries.

Line breaks are not included in the resulting list unless keepends is given and true.

startswith(prefix[, start[, end]]) bool[source]

Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.

strip(chars=None, /)[source]

Return a copy of the string with leading and trailing whitespace removed.

If chars is given and not None, remove characters in chars instead.

swapcase()[source]

Convert uppercase characters to lowercase and lowercase characters to uppercase.

title()[source]

Return a version of the string where each word is titlecased.

More specifically, words start with uppercased characters and all remaining cased characters have lower case.

translate(table, /)[source]

Replace each character in the string using the given translation table.

table

Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.

The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.

upper()[source]

Return a copy of the string converted to uppercase.

zfill(width, /)[source]

Pad a numeric string with zeros on the left, to fill a field of the given width.

The string is never truncated.

class integreat_cms.cms.views.pages.page_permission_actions.PermissionMessage(message: str, level_tag: MessageLevel)[source]

Bases: object

Saves message and level_tag of the return message

Parameters:
__init__(message: str, level_tag: MessageLevel)[source]
Parameters:
class integreat_cms.cms.views.pages.page_permission_actions.PublishPagePermission[source]

Bases: AbstractPagePermission

Implementation of AbstractPagePermission for publishing page permissions

__init__() None[source]
Return type:

None

build_grant_message(user: User, page: Page) PermissionMessage[source]

Build the success message when granting a permission

Parameters:
  • user (User) – user that is granted a permission

  • page (Page) – page the user is granted the permission for

Returns:

message with level_tag

Return type:

PermissionMessage

build_revoke_message(user: User, page: Page) PermissionMessage[source]

Build the response message after revoking

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

permission message

Return type:

PermissionMessage

grant_permission(user: User, page: Page) PermissionMessage[source]

Grant the permission

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

Response message

Return type:

PermissionMessage

grant_success_message = 'Success: The user "{}" can now publish this page.'[source]
revoke_permission(user: User, page: Page) PermissionMessage[source]

Revoke the permission

Parameters:
  • user (User) – User the permission is changed for

  • page (Page) – Page the permission is changed for

Returns:

Response message

Return type:

PermissionMessage

revoke_success_message = 'Success: The user "{}" cannot publish this page anymore.'[source]
revoke_with_no_effect_success_message = 'Information: The user "{}" has been removed from the editors of this page, but has the implicit permission to publish this page anyway.'[source]
save_grant_permission(user: User, page: Page) None[source]

Grant the permission and save changes

Parameters:
  • user (User) – User the permission should be changed for

  • page (Page) – Page the permission should be changed for

Return type:

None

save_revoke_permission(user: User, page: Page) None[source]

Revoke the permission and save changes

Parameters:
  • user (User) – User the permission should be changed for

  • page (Page) – Page the permission should be changed for

Return type:

None

integreat_cms.cms.views.pages.page_permission_actions.ensure_page_specific_permissions_enabled(region: Region) None[source]

Ensure the page permission is enabled

Parameters:

region (Region) – The region the page permission should be enabled for

Raises:

PermissionDenied – If page permissions are disabled for this region

Return type:

None

integreat_cms.cms.views.pages.page_permission_actions.ensure_user_has_correct_permissions(request: HttpRequest, page: Page, user: User) None[source]

Ensure the user has correct permissions

Parameters:
  • request (HttpRequest) – request

  • page (Page) – page the permission should be changed for

  • user (User) – user the permission should be changed for

Raises:

PermissionDenied – If the user does not have the permission to grant page permissions

Return type:

None

integreat_cms.cms.views.pages.page_permission_actions.get_permission(data: Any) AbstractPagePermission[source]

Gets the Permission object for the requested permission

Parameters:

data (Any) – Request data

Raises:

PermissionDenied – If unknown page permissions should be changed

Returns:

Permission object

Return type:

AbstractPagePermission

integreat_cms.cms.views.pages.page_permission_actions.grant_page_permission_ajax(request: HttpRequest, region_slug: str) HttpResponse[source]

Grant a user editing or publishing permissions on a specific page object

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

Raises:

PermissionDenied – If page permissions are disabled for this region or the user does not have the permission to grant page permissions

Returns:

The rendered page permission table

Return type:

HttpResponse

integreat_cms.cms.views.pages.page_permission_actions.log_permission_request(request: HttpRequest, user: User, permission: AbstractPagePermission, page: Page, grant: bool) None[source]

Logging for page permission request

Parameters:
  • request (HttpRequest) – Request

  • user (User) – user that should be granted or revoked a permission

  • permission (AbstractPagePermission) – permission that should be granted or revoked

  • page (Page) – page for which the permission should be granted or revoked

  • grant (bool) – if the permission is granted or revoked

Return type:

None

integreat_cms.cms.views.pages.page_permission_actions.revoke_page_permission_ajax(request: HttpRequest, region_slug: str) HttpResponse[source]

Remove a page permission for a given user and page

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

Raises:

PermissionDenied – If page permissions are disabled for this region or the user does not have the permission to revoke page permissions

Returns:

The rendered page permission table

Return type:

HttpResponse

Page Sbs View

class integreat_cms.cms.views.pages.page_sbs_view.PageSideBySideView(**kwargs)[source]

Bases: TemplateView, PageContextMixin, MediaContextMixin, ContentEditLockMixin

View for the page side by side form

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

back_url_name: str | None = 'pages'[source]

The url name of the view to show if the user decides to go back (see ContentEditLockMixin)

content_type = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse | HttpResponseRedirect[source]

Render PageTranslationForm on the side by side view

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The rendered template response

Return type:

HttpResponse | HttpResponseRedirect

get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Submit PageTranslationForm and save PageTranslation object

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Raises:

PermissionDenied – If user does not have the permission to edit pages

Returns:

The rendered template response

Return type:

HttpResponse

render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class[source]

alias of TemplateResponse

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

template_engine = None[source]
template_name = 'pages/page_sbs.html'[source]

The template to render (see TemplateResponseMixin)

view_is_async = False[source]
integreat_cms.cms.views.pages.page_sbs_view.get_old_source_content(page: Page, source_language: Language, target_language: Language) str[source]

This function returns the content of the source language translation that was up to date when the latest (no minor edit) target language translation was created.

Parameters:
  • page (Page) – The page

  • source_language (Language) – The source language of the page

  • target_language (Language) – The target language of the page

Returns:

The content of the translation

Return type:

str

Page Tree View

class integreat_cms.cms.views.pages.page_tree_view.PageTreeView(**kwargs)[source]

Bases: TemplateView, PageContextMixin, MachineTranslationContextMixin

View for showing the page tree

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

archived = False[source]

Whether or not to show archived pages

classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

content_type = None[source]
dispatch(request, *args, **kwargs)[source]
extra_context = None[source]
get(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Render page tree

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The rendered template response

Return type:

HttpResponse

get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class[source]

alias of TemplateResponse

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

template = 'pages/page_tree.html'[source]

Template for list of non-archived pages

template_archived = 'pages/page_tree_archived.html'[source]

Template for list of archived pages

template_engine = None[source]
property template_name: str[source]

Select correct HTML template, depending on archived flag (see TemplateResponseMixin)

Returns:

Path to HTML template

translation_model[source]

The translation model of this list view (used to determine whether machine translations are permitted)

Parameters:
  • id (BigAutoField) – Primary key: ID

  • title (CharField) – Title of the page

  • slug (SlugField) – Page link. String identifier without spaces and special characters. Unique per region and language. Leave blank to generate unique parameter from title.

  • status (CharField) – Status

  • content (TextField) – Content of the page

  • currently_in_translation (BooleanField) – Currently in translation. Flag to indicate a translation is being updated by an external translator

  • machine_translated (BooleanField) – Machine translated. Flag to indicate whether a translations is machine translated

  • version (PositiveIntegerField) – Revision

  • minor_edit (BooleanField) – Minor edit. Tick if this change does not require an update of translations in other languages.

  • last_updated (DateTimeField) – Modification date

  • automatic_translation (BooleanField) – Automatic translation. Tick if updating this content should automatically refresh or create its translations.

  • hix_score (FloatField) – HIX score

Relationship fields:

Parameters:

Reverse relationships:

Parameters:

feedback (Reverse ForeignKey from PageFeedback) – All feedback of this page translation (related name of page_translation)

alias of PageTranslation

view_is_async = False[source]

Page Version View

class integreat_cms.cms.views.pages.page_version_view.PageVersionView(**kwargs)[source]

Bases: PageContextMixin, ContentVersionView

View for browsing the page versions and restoring old page versions

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

back_to_form_label: Promise = 'Back to the page form'[source]

The label of the “back to form” button

content_type = None[source]
context_object_name = None[source]
dispatch(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect | TemplateResponse[source]

Validate the versions view

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

The rendered template response

Return type:

HttpResponseRedirect | TemplateResponse

property edit_url: str[source]

The url to the form in the current language

Returns:

The edit url

extra_context = None[source]
get(request, *args, **kwargs)[source]
get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

get_context_object_name(obj)[source]

Get the name to use for the object.

get_login_url()[source]

Override this method to override the login_url attribute.

get_object(queryset=None)[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

get_permission_denied_message()[source]

Override this method to override the permission_denied_message attribute.

get_permission_required()[source]

Override this method to override the permission_required attribute. Must return an iterable.

get_queryset()[source]

Filter the content objects by the current region

Raises:

Http404 – HTTP status 404 if the content is not found

Returns:

The rendered template response

Return type:

ContentQuerySet | (EventQuerySet | PageQuerySet)

get_redirect_field_name()[source]

Override this method to override the redirect_field_name attribute.

get_slug_field()[source]

Get the name of a slug field to be used to look up by slug.

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.

handle_no_permission()[source]
has_change_permission() bool[source]

Whether the user has the permission to change objects

Returns:

Whether the user can change objects

Return type:

bool

has_permission() bool[source]

Override django.contrib.auth.mixins.PermissionRequiredMixin.has_permission()

Returns:

Whether the current user can access this view

Return type:

bool

has_publish_permission() bool[source]

Whether the user has the permission to publish objects

Returns:

Whether the user can publish objects

Return type:

bool

has_view_permission() bool[source]

Whether the user has the permission to change objects

Returns:

Whether the user can change objects

Return type:

bool

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
language: Language | None = None[source]

The current language

login_url = None[source]
model[source]

The current content model (see SingleObjectMixin)

Parameters:

Relationship fields:

Parameters:
  • parent (ForeignKey to Page) – Parent page (related name: children)

  • region (ForeignKey to Region) – Region (related name: pages)

  • icon (ForeignKey to MediaFile) – Icon (related name: pages)

  • mirrored_page (ForeignKey to Page) – Mirrored page. If the page embeds live content from another page, it is referenced here. (related name: mirroring_pages)

  • organization (ForeignKey to Organization) – Responsible organization. This allows all members of the organization to edit and publish this page. (related name: pages)

  • authors (ManyToManyField to User) – Authors. A list of users who have the permission to edit this specific page. Only has effect if these users do not have the permission to edit pages anyway. (related name: editable_pages)

  • editors (ManyToManyField to User) – Editors. A list of users who have the permission to publish this specific page. Only has effect if these users do not have the permission to publish pages anyway. (related name: publishable_pages)

  • embedded_offers (ManyToManyField to OfferTemplate) – Page based offer. Select an offer provider whose offers should be displayed on this page. (related name: pages)

Reverse relationships:

Parameters:

alias of Page

property model_name: str[source]

The name of this model

Returns:

The name of this model

object: AbstractContentModel | None = None[source]

The current content object (see SingleObjectMixin)

options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

permission_denied_message = ''[source]
permission_required = None[source]
property pk_url_kwarg: str[source]

The name of the URLConf keyword argument that contains the primary key. By default, pk_url_kwarg is ‘pk’. See django.views.generic.detail.SingleObjectMixin.pk_url_kwarg.

Returns:

The name of URL kwarg of the id

post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Restore a previous revision of a page translation

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Raises:

PermissionDenied – If user does not have the permission to edit the specific page

Returns:

The rendered template response

Return type:

HttpResponseRedirect

query_pk_and_slug = False[source]
queryset = None[source]
raise_exception = False[source]
redirect_field_name = 'next'[source]
render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class[source]

alias of TemplateResponse

restore_version(restored_version: Any) None[source]

Restore the given version

Parameters:

restored_version (Any) – The version which should be restored

Return type:

None

selected_version: AbstractContentTranslation | None = None[source]

The currently selected translation version

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

slug_field = 'slug'[source]
slug_url_kwarg = 'slug'[source]
template_engine = None[source]
template_name: str = 'content_versions.html'[source]

The template to render (see TemplateResponseMixin)

translations: list[AbstractContentTranslation] = [][source]

All translations of the content object in the current language

property versions_url: str[source]

The url to the form in the current language

Returns:

The edit url

view_is_async = False[source]

Page XLIFF Import View

class integreat_cms.cms.views.pages.page_xliff_import_view.PageXliffImportView(**kwargs)[source]

Bases: TemplateView, PageContextMixin

View for importing uploaded XLIFF files

__init__(**kwargs)[source]

Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.

classmethod as_view(**initkwargs)[source]

Main entry point for a request-response process.

content_type = None[source]
dispatch(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponse[source]

Redirect to page tree if XLIFF directory does not exist

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The rendered template response

Return type:

HttpResponse

extra_context = None[source]
get(request, *args, **kwargs)[source]
get_context_data(**kwargs: Any) dict[str, Any][source]

Returns a dictionary representing the template context (see get_context_data()).

Parameters:

**kwargs (Any) – The given keyword arguments

Returns:

The template context

Return type:

dict[str, Any]

get_template_names()[source]

Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.

http_method_names = ['get', 'post', 'put', 'patch', 'delete', 'head', 'options', 'trace'][source]
http_method_not_allowed(request, *args, **kwargs)[source]
language = None[source]

The language of this view

options(request, *args, **kwargs)[source]

Handle responding to requests for the OPTIONS HTTP verb.

post(request: HttpRequest, *args: Any, **kwargs: Any) HttpResponseRedirect[source]

Confirm the xliff import

Parameters:
  • request (HttpRequest) – The current request

  • *args (Any) – The supplied arguments

  • **kwargs (Any) – The supplied keyword arguments

Returns:

The rendered template response

Return type:

HttpResponseRedirect

region = None[source]

The region of this view

render_to_response(context, **response_kwargs)[source]

Return a response, using the response_class for this view, with a template rendered with the given context.

Pass response_kwargs to the constructor of the response class.

response_class[source]

alias of TemplateResponse

setup(request, *args, **kwargs)[source]

Initialize attributes shared by all view methods.

template_engine = None[source]
template_name = 'pages/page_xliff_import_view.html'[source]

Template for XLIFF import view

view_is_async = False[source]
xliff_dir = None[source]

The upload directory of this import

Partial Page Tree View

integreat_cms.cms.views.pages.partial_page_tree_view.render_partial_page_tree_views(request: HttpRequest, region_slug: str, language_slug: str) JsonResponse[source]

Retrieve the rendered subtree of a given root page

Parameters:
  • request (HttpRequest) – The current request

  • region_slug (str) – The slug of the current region

  • language_slug (str) – The slug of the current language

Returns:

The rendered template responses

Return type:

JsonResponse