org.models.external_link
Classes
An Object appearing in some other collection |
|
Abstract base class for generic types. |
Module Contents
- class org.models.external_link.ExternalLink[source]
Bases:
onegov.core.orm.Base
,onegov.core.orm.mixins.ContentMixin
,onegov.core.orm.mixins.TimestampMixin
,onegov.org.models.AccessExtension
,onegov.search.SearchableContent
An Object appearing in some other collection that features a lead and text but points to some external url.
- es_properties[source]
Returns the type mapping of this model. Each property in the mapping will be read from the model instance.
The returned object needs to be a dict or an object that provides a
to_dict
method.Internally, onegov.search stores differing languages in different indices. It does this automatically through langauge detection, or by manually specifying a language.
Note that objects with multiple languages are not supported (each object is supposed to have exactly one language).
Onegov.search will automatically insert the right analyzer for types like these.
There’s currently only limited support for properties here, namely objects and nested mappings do not work! This is going to be added in the future though.
- class org.models.external_link.ExternalLinkCollection(session: sqlalchemy.orm.Session, member_of: str | None = None, group: str | None = None, type: str | None = None)[source]
Bases:
onegov.core.collection.GenericCollection
[ExternalLink
]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
- static translatable_name(model_class: type[object]) str [source]
Most collections have a base model whose name can be guessed from the collection name.
- classmethod collection_by_name() dict[str, type[onegov.core.collection.GenericCollection[Any]]] [source]
- property model_class: type[ExternalLink][source]
- classmethod target(external_link: ExternalLink) type[onegov.core.collection.GenericCollection[Any]] [source]
- query() Query[ExternalLink] [source]