org.models.page

Classes

Topic

Defines a generic page.

News

Defines a generic page.

AtoZPages

Abstract base class for generic types.

Module Contents

class org.models.page.Topic(title: str, parent: Self | None = None, **kwargs: Any)[source]

Bases: onegov.page.Page, onegov.org.models.traitinfo.TraitInfo, onegov.search.SearchableContent, onegov.org.models.extensions.AccessExtension, onegov.org.models.extensions.PublicationExtension, onegov.org.models.extensions.VisibleOnHomepageExtension, onegov.org.models.extensions.ContactExtension, onegov.org.models.extensions.ContactHiddenOnPageExtension, onegov.org.models.extensions.PeopleShownOnMainPageExtension, onegov.org.models.extensions.PersonLinkExtension, onegov.org.models.extensions.CoordinatesExtension, onegov.org.models.extensions.ImageExtension, onegov.org.models.extensions.GeneralFileLinkExtension, onegov.org.models.extensions.SidebarLinksExtension

Defines a generic page.

__mapper_args__[source]
es_type_name = 'topics'[source]
lead: onegov.core.orm.mixins.dict_property[str | None][source]
text: onegov.core.orm.mixins.dict_property[str | None][source]
url: onegov.core.orm.mixins.dict_property[str | None][source]
as_card: onegov.core.orm.mixins.dict_property[str | None][source]
height: onegov.core.orm.mixins.dict_property[str | None][source]
lead_when_child: onegov.core.orm.mixins.dict_property[bool][source]
property es_skip: bool[source]

Returns True if the indexing of this specific model instance should be skipped.

property es_public: bool[source]

Returns True if the model is available to be found by the public. If false, only editors/admins will see this object in the search results.

property deletable: bool[source]

Returns true if this page may be deleted.

property editable: bool[source]
property url_changeable: bool[source]

Open for all topics, even root ones.

property paste_target: Topic | News[source]

Returns the page that should be used as parent for the content pasting if paste is called on the current page (self).

This is usually just self. If the paste action should put the content alongside the current page, it would be the parent.

property allowed_subtraits: tuple[str, Ellipsis][source]

Returns a list of traits that this page may contain.

is_supported_trait(trait: str) bool[source]

Returns true if the given trait is supported by this type This doesn’t mean that the trait may be added to this page, it serves as a simple sanity check, returning True if the combination of the type and the trait make any sense at all.

get_form_class(trait: str, action: str, request: onegov.org.request.OrgRequest) type[onegov.org.forms.LinkForm | onegov.org.forms.PageForm | onegov.org.forms.IframeForm][source]

Returns the form class for the given trait, action.

class org.models.page.News(title: str, parent: Self | None = None, **kwargs: Any)[source]

Bases: onegov.page.Page, onegov.org.models.traitinfo.TraitInfo, onegov.search.SearchableContent, onegov.org.models.extensions.NewsletterExtension, onegov.org.models.extensions.AccessExtension, onegov.org.models.extensions.PublicationExtension, onegov.org.models.extensions.VisibleOnHomepageExtension, onegov.org.models.extensions.ContactExtension, onegov.org.models.extensions.ContactHiddenOnPageExtension, onegov.org.models.extensions.PeopleShownOnMainPageExtension, onegov.org.models.extensions.PersonLinkExtension, onegov.org.models.extensions.CoordinatesExtension, onegov.org.models.extensions.ImageExtension, onegov.org.models.extensions.GeneralFileLinkExtension, onegov.org.models.extensions.DeletableContentExtension

Defines a generic page.

__mapper_args__[source]
es_type_name = 'news'[source]
lead: onegov.core.orm.mixins.dict_property[str | None][source]
text: onegov.core.orm.mixins.dict_property[str | None][source]
url: onegov.core.orm.mixins.dict_property[str | None][source]
filter_years: list[int] = [][source]
filter_tags: list[str] = [][source]
hashtags: onegov.core.orm.mixins.dict_property[list[str]][source]
property es_public: bool[source]

Returns True if the model is available to be found by the public. If false, only editors/admins will see this object in the search results.

content_observer(content: dict[str, Any]) None[source]
property absorb: str[source]

Alias for path. This is a convenience feature for Morepath if a path is absorbed.

See https://morepath.readthedocs.org/en/latest/paths_and_linking.html?highlight=absorb#absorbing

property deletable: bool[source]
property editable: bool[source]
property url_changeable: bool[source]

Open for all topics, even root ones.

property paste_target: Topic | News[source]

Returns the page that should be used as parent for the content pasting if paste is called on the current page (self).

This is usually just self. If the paste action should put the content alongside the current page, it would be the parent.

property allowed_subtraits: tuple[str, Ellipsis][source]

Returns a list of traits that this page may contain.

is_supported_trait(trait: str) bool[source]

Returns true if the given trait is supported by this type This doesn’t mean that the trait may be added to this page, it serves as a simple sanity check, returning True if the combination of the type and the trait make any sense at all.

get_root_page_form_class(request: onegov.org.request.OrgRequest) type[onegov.form.Form][source]
get_form_class(trait: str, action: str, request: onegov.org.request.OrgRequest) type[onegov.form.Form | onegov.org.forms.PageForm][source]

Returns the form class for the given trait, action.

for_year(year: int) News[source]
for_tag(tag: str) News[source]
news_query(limit: int | None = 2, published_only: bool = True) Query[News][source]
property all_years: list[int][source]
property all_tags: list[str][source]
class org.models.page.AtoZPages(request: onegov.org.request.OrgRequest)[source]

Bases: onegov.org.models.atoz.AtoZ[Topic]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
get_title(item: Topic) str[source]
get_items() list[Topic][source]