OneGov Docs
  • The Design of OneGov Cloud
  • OneGov Org - OneGov Cloud’s Flagship Application
  • Feriennet - A Complicated Org
  • Write Forms with Formcode Syntax
  • OneGov Agency API
  • OneGov Election Day API
  • OneGov Cloud Modules
  • API Reference
    • fsi
    • pas
    • gis
    • pay
    • org
      • Submodules
        • org.app
        • org.auth
        • org.boardlets
        • org.cli
        • org.constants
        • org.converters
        • org.cronjobs
        • org.custom
        • org.directives
        • org.elements
        • org.exceptions
        • org.exports
        • org.formats
        • org.forms
        • org.homepage_widgets
        • org.i18n
        • org.initial_content
        • org.kaba
        • org.layout
        • org.mail
        • org.management
        • org.models
        • org.notification_service
        • org.observer
        • org.open_graph
        • org.path
        • org.pdf
        • org.redirects
        • org.request
        • org.security
        • org.theme
        • org.translations
        • org.upgrade
        • org.utils
        • org.views
      • Attributes
      • Package Contents
    • api
    • pdf
    • chat
    • core
    • page
    • form
    • file
    • user
    • town6
    • gever
    • event
    • quill
    • agency
    • server
    • search
    • people
    • qrcode
    • ticket
    • shared
    • notice
    • gazette
    • activity
    • intranet
    • directory
    • feriennet
    • recipient
    • plausible
    • winterthur
    • swissvotes
    • onboarding
    • websockets
    • async_http
    • foundation
    • newsletter
    • foundation6
    • reservation
    • election_day
    • stepsequence
    • landsgemeinde
    • translator_directory
OneGov Docs
  • API Reference
  • org
  • org.models
  • org.models.external_link
  • View page source

org.models.external_link

Classes

ExternalLink

An Object appearing in some other collection

ExternalLinkCollection

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.

__tablename__ = 'external_links'[source]
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.

id: sqlalchemy.Column[uuid.UUID][source]
title: sqlalchemy.Column[str][source]
url: sqlalchemy.Column[str][source]
page_image: onegov.core.orm.mixins.dict_property[str | None][source]
member_of: sqlalchemy.Column[str | None][source]
group: sqlalchemy.Column[str | None][source]
order: sqlalchemy.Column[str][source]
es_type_name = 'external_links'[source]

Returns the unique type name of the model.

es_id = 'title'[source]

The name of the id attribute (not the actual value!).

If you use this on an ORM model, be sure to use a primary key, all other properties are not available during deletion.

lead: onegov.core.orm.mixins.dict_property[str | None][source]
title_observer(title: str) → None[source]
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
supported_collections[source]
member_of = None[source]
group = None[source]
type = None[source]
static translatable_name(model_class: type[object]) → str[source]

Most collections have a base model whose name can be guessed from the collection name.

form_choices() → tuple[tuple[str, str], Ellipsis][source]
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() → sqlalchemy.orm.Query[ExternalLink][source]
classmethod for_model(session: sqlalchemy.orm.Session, model_class: type[onegov.form.FormCollection | onegov.reservation.ResourceCollection], **kwargs: Any) → Self[source]

It would be better to use the tablename, but the collections do not always implement the property model_class.

Previous Next

© Copyright 2025, Verein OneGov.

Built with Sphinx using a theme provided by Read the Docs.