Pages

Forms for creating and modifying page and page translation objects

Mirrored Page Field Widget

class integreat_cms.cms.forms.pages.mirrored_page_field_widget.MirroredPageFieldWidget(attrs=None, choices=())[source]

Bases: Select

This Widget class is used to append the url for retrieving the preview of the mirrored page to the data attributes of the options

create_option(name: str, value: int, label: str, selected: bool, index: int, subindex: int | None = None, attrs: dict | None = None) dict[source]

This function creates an option which can be selected in the parent field

Parameters:
  • name (str) – The name of the option

  • value (int) – the value of the option (the page id)

  • label (str) – The label of the option

  • selected (bool) – Whether or not the option is selected

  • index (int) – The index of the option

  • subindex (int | None) – The subindex of the option

  • attrs (dict | None) – The attributes of the option

Returns:

The option dict

Return type:

dict

form: PageForm | None = None[source]

The form this field is bound to

language_slug: str | None = None[source]

The current language slug

Page Filter Form

class integreat_cms.cms.forms.pages.page_filter_form.PageFilterForm(**kwargs: Any)[source]

Bases: CustomFilterForm

Form for filtering page objects

Form fields:

Parameters:

kwargs (Any)

__init__(**kwargs: Any) None[source]

Initialize page filter form

Parameters:

**kwargs (Any) – The supplied keyword arguments

Return type:

None

apply(pages: list[Page], language_slug: str) list[Page][source]

Filter the pages list according to the given filter data

Parameters:
  • pages (list[Page]) – The list of pages

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

Returns:

The filtered page list

Return type:

list[Page]

filter_by_end_date(pages: list[Page], language_slug: str) list[Page][source]

Filter the pages list by end date

Parameters:
  • pages (list[Page]) – The list of pages

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

Returns:

The filtered page list

Return type:

list[Page]

filter_by_pages_with_content(pages: list[Page], language_slug: str) list[Page][source]

Filter only by pages that have content (including empty pages with live content) :param pages: The list of pages :param language_slug: The slug of the current language :return: pages that have content

Parameters:
Return type:

list[Page]

filter_by_publication_status(pages: list[Page], language_slug: str) list[Page][source]

Filter the pages list by publication status

Parameters:
  • pages (list[Page]) – The list of pages

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

Returns:

The filtered page list

Return type:

list[Page]

filter_by_query(pages: list[Page], language_slug: str) list[Page][source]

Filter the pages list by a given search query

Parameters:
  • pages (list[Page]) – The list of pages

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

Returns:

The filtered page list

Return type:

list[Page]

filter_by_start_date(pages: list[Page], language_slug: str) list[Page][source]

Filter the pages list by start date

Parameters:
  • pages (list[Page]) – The list of pages

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

Returns:

The filtered page list

Return type:

list[Page]

filter_by_translation_status(pages: list[Page], language_slug: str) list[Page][source]

Filter the pages list by a given translation status

Parameters:
  • pages (list[Page]) – The list of pages

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

Returns:

The filtered page list

Return type:

list[Page]

property media[source]

Return all media required to render the widgets on this form.

Page Form

class integreat_cms.cms.forms.pages.page_form.PageForm(**kwargs: Any)[source]

Bases: CustomModelForm, CustomTreeNodeForm

Form for creating and modifying page objects

Form fields:

Parameters:

kwargs (Any)

__init__(**kwargs: Any) None[source]

Initialize page form

Parameters:

**kwargs (Any) – The supplied keyword arguments

Return type:

None

get_author_queryset() QuerySet[source]

This method retrieves all users, who are eligible to be defined as page authors because they don’t yet have the permission to edit this page.

Returns:

All potential page authors

Return type:

QuerySet

get_editor_queryset() QuerySet[source]

This method retrieves all users, who are eligible to be defined as page editors because they don’t yet have the permission to publish this page.

Returns:

All potential page editors

Return type:

QuerySet

property media[source]

Return all media required to render the widgets on this form.

save(commit: bool = True) Any[source]

This method extends the default save()-method of the base ModelForm to provide debug logging

Parameters:

commit (bool) – Whether or not the changes should be written to the database

Returns:

The saved object returned by The save() method

Return type:

Any

Page Translation Form

class integreat_cms.cms.forms.pages.page_translation_form.PageTranslationForm(**kwargs: Any)[source]

Bases: MachineTranslationForm

Form for creating and modifying page translation objects

Form fields:

Parameters:

kwargs (Any)

property media[source]

Return all media required to render the widgets on this form.

Parent Field Widget

class integreat_cms.cms.forms.pages.parent_field_widget.ParentFieldWidget(attrs=None, choices=())[source]

Bases: Select

This Widget class is used to append the url for retrieving the page order tables to the data attributes of the options

create_option(name: str, value: int | str, label: SafeString | str, selected: bool, index: int, subindex: Any | None = None, attrs: dict[str, Any] | None = None) dict[str, Any][source]

This function creates an option which can be selected in the parent field

Parameters:
  • name (str) – The name of the option

  • value (int | str) – the value of the option (the page id)

  • label (SafeString | str) – The label of the option

  • selected (bool) – Whether or not the option is selected

  • index (int) – The index of the option

  • subindex (Any | None) – The subindex of the option

  • attrs (dict[str, Any] | None) – The attributes of the option

Returns:

The option dict

Return type:

dict[str, Any]

form = None[source]

The form this field is bound to