org.models.traitinfo

Attributes

TRAIT_MESSAGES

Classes

TraitInfo

" Typically used as a mixin for adjacency list based models,

Module Contents

org.models.traitinfo.TRAIT_MESSAGES: dict[str, dict[str, str]][source]
class org.models.traitinfo.TraitInfo[source]

“ Typically used as a mixin for adjacency list based models, this class provides access to the trait related methods.

Traits are like subtypes of models. For example, the Page model has a page trait and a link trait. Both are managed under the same tree as the same type (Page), but one is rendered as a redirect, the other as a normal page.

title: sqlalchemy.Column[str][source]
property trait: str | None[source]

Gets the trait of the page.

property trait_messages: dict[str, dict[str, str]][source]

Returns all trait_messages.

property allowed_subtraits: Sequence[str][source]
Abstractmethod:

Returns a list of traits that this page may contain.

property paste_target: TraitInfo[source]
Abstractmethod:

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.

abstract 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.

abstract get_form_class(trait: str, action: str, request: onegov.org.request.OrgRequest) type[onegov.form.Form][source]

Returns the form class for the given trait, action.

Returns the editbar links on the private view of this trait.

Yields the add links shown on the private view of this trait.

Yields the edit links shown on the private view of this trait.