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:
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:
status
: Publication status (ChoiceField
)date_from
: From (DateField
)date_to
: To (DateField
)translation_status
: Translation status (MultipleChoiceField
)exclude_pages_without_content
: Exclude pages without content (BooleanField
)query
: Query (CharField
)
- 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
- filter_by_end_date(pages: list[Page], language_slug: str) list[Page] [source]
Filter the pages list by end date
- 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
- filter_by_publication_status(pages: list[Page], language_slug: str) list[Page] [source]
Filter the pages list by publication status
- filter_by_query(pages: list[Page], language_slug: str) list[Page] [source]
Filter the pages list by a given search query
- filter_by_start_date(pages: list[Page], language_slug: str) list[Page] [source]
Filter the pages list by start date
- filter_by_translation_status(pages: list[Page], language_slug: str) list[Page] [source]
Filter the pages list by a given translation status
- 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:
icon
: Icon (ModelChoiceField
)mirrored_page
: Mirrored page (ModelChoiceField
)mirrored_page_first
: Position of mirrored page (NullBooleanField
)organization
: Responsible organization (ModelChoiceField
)parent
: Parent page (ModelChoiceField
)api_token
: API access token (CharField
)hix_ignore
: Ignore HIX value (BooleanField
)embedded_offers
: Page based offer (ModelMultipleChoiceField
)_position
: Position (ChoiceField
)_ref_node_id
: Relative to (ChoiceField
)authors
: Authors (ModelChoiceField
)editors
: Editors (ModelChoiceField
)mirrored_page_region
: Source region for live content (ModelChoiceField
)enable_api_token
: Enable write access via API for this page (BooleanField
)
- 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 baseModelForm
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:
title
: Title of the page (CharField
)status
: Status (TypedChoiceField
)content
: Content of the page (CharField
)minor_edit
: Minor edit (BooleanField
)automatic_translation
: Automatic translation (BooleanField
)machine_translated
: Machine translated (BooleanField
)slug
: Page link (SlugField
)hix_score
: HIX score (FloatField
)hix_feedback
: HIX feedback (JSONField
)mt_translations_to_create
: Create new translations: (ModelMultipleChoiceField
)mt_translations_to_update
: Update existing translations: (ModelMultipleChoiceField
)
- 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:
- Returns:
The option dict
- Return type:
- form = None[source]
The form this field is bound to