org.forms.page

Classes

PageBaseForm

Defines the base form for all pages.

LinkForm

Defines the form for pages with the 'link' trait.

PageForm

Defines the form for pages with the 'page' trait.

IframeForm

Defines the form for pages with the 'iframe' trait.

PageUrlForm

MovePageForm

Form to move a page including its subpages.

Functions

parent_choices(form, field) → list[wtforms.fields.SelectChoice]

Module Contents

class org.forms.page.PageBaseForm[source]

Bases: onegov.form.Form

Defines the base form for all pages.

title[source]
class org.forms.page.LinkForm[source]

Bases: PageBaseForm

Defines the form for pages with the ‘link’ trait.

url[source]
page_image[source]
class org.forms.page.PageForm[source]

Bases: PageBaseForm

Defines the form for pages with the ‘page’ trait.

lead[source]
text[source]
keywords[source]
lead_when_child[source]
on_request() → None[source]
class org.forms.page.IframeForm[source]

Bases: PageBaseForm

Defines the form for pages with the ‘iframe’ trait.

lead[source]
allowed_domains: list[str] = [][source]
domain_hint[source]
url[source]
height[source]
as_card[source]
on_request() → None[source]
validate_url(field: onegov.form.fields.URLField) → None[source]

Validates the URL against the iFrame allow-list.

This implements only a subset of CSP source matching: the scheme (an http source also allows https, an empty scheme allows any) and the host (with wildcard support, e.g. *.vimeo.com). Ports and paths on the allow-list entries are not honoured.

class org.forms.page.PageUrlForm[source]

Bases: onegov.org.forms.generic.ChangeAdjacencyListUrlForm

get_model() → onegov.page.Page[source]
org.forms.page.parent_choices(form: MovePageForm, field: onegov.form.fields.ChosenSelectField) → list[wtforms.fields.SelectChoice][source]
class org.forms.page.MovePageForm[source]

Bases: onegov.form.Form

Form to move a page including its subpages.

parent_id[source]
iterate_page_tree(pages: collections.abc.Iterable[onegov.page.Page], indent: str = '') → collections.abc.Iterator[wtforms.fields.SelectChoice][source]

Iterates over the page tree and lists the elements with ident to show the page hierarchy in the choices list

validate_parent_id(field: onegov.form.fields.ChosenSelectField) → None[source]

As a new destination (parent page) every menu item is valid except yourself or a child of yourself.

update_model(model: onegov.page.Page) → None[source]