directory.models.directory

Attributes

InheritType

INHERIT

Classes

_Sentinel

Create a collection of name/value pairs.

DirectoryFile

A general file (image, document, pdf, etc), referenced in the database.

Directory

A directory of entries that share a common data structure. For example,

EntryRecipient

Represents a single recipient.

EntrySubscription

Adds subscription management to a recipient.

Module Contents

directory.models.directory.InheritType: typing_extensions.TypeAlias = 'Literal[_Sentinel.INHERIT]'[source]
class directory.models.directory._Sentinel(*args, **kwds)[source]

Bases: enum.Enum

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

INHERIT[source]
directory.models.directory.INHERIT[source]
class directory.models.directory.DirectoryFile[source]

Bases: onegov.file.File

A general file (image, document, pdf, etc), referenced in the database.

Thanks to the use of Depot files can be seemingly stored in the database (with transaction guarantees), without actually storing it in the database.

__mapper_args__[source]
property directory_entry: DirectoryEntry | None[source]
property access: str[source]
class directory.models.directory.Directory[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.ContentMixin, onegov.core.orm.mixins.TimestampMixin, onegov.search.SearchableContent, onegov.file.MultiAssociatedFiles

A directory of entries that share a common data structure. For example, a directory of people, of emergency services or playgrounds.

__tablename__ = 'directories'[source]
es_properties[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.

id: Column[uuid.UUID][source]
name: Column[str][source]
title: Column[str][source]
lead: Column[str | None][source]
order: Column[str][source]
type: Column[str][source]
structure: Column[str][source]
configuration: Column[DirectoryConfiguration][source]
count() ColumnElement[int][source]
__mapper_args__[source]
entries: relationship[list[DirectoryEntry]][source]
property entry_cls_name: str[source]
property entry_cls: _type[DirectoryEntry][source]
add(values: dict[str, Any], type: str | InheritType = INHERIT) directory.models.directory_entry.DirectoryEntry[source]
add_by_form(form: DirectoryEntryForm, type: str | InheritType = INHERIT) directory.models.directory_entry.DirectoryEntry[source]
update(entry: directory.models.directory_entry.DirectoryEntry, values: Mapping[str, Any], set_name: bool = False, force_update: bool = False) directory.models.directory_entry.DirectoryEntry[source]
title_observer(title: str) None[source]
structure_configuration_observer(structure: str, configuration: directory.types.DirectoryConfiguration) None[source]
entry_with_name_exists(name: str) bool[source]
migration(new_structure: str, new_configuration: directory.types.DirectoryConfiguration) onegov.directory.migration.DirectoryMigration[source]
property fields: Sequence[ParsedField][source]
static fields_from_structure(structure: str) Sequence[ParsedField][source]
property basic_fields: Sequence[BasicParsedField][source]
property file_fields: Sequence[FileParsedField][source]
field_by_id(id: str) ParsedField | None[source]
property form_obj: DirectoryEntryForm[source]
property form_class: _type[DirectoryEntryForm][source]
form_obj_from_structure(structure: str) DirectoryEntryForm[source]
form_class_from_structure(structure: str) _type[DirectoryEntryForm][source]
class directory.models.directory.EntryRecipient[source]

Bases: onegov.core.orm.Base, onegov.core.orm.mixins.TimestampMixin

Represents a single recipient.

__tablename__ = 'entry_recipients'[source]
id: Column[uuid.UUID][source]
address: Column[str][source]
validate_address(key: str, address: str) str[source]
token: Column[str][source]
confirmed: Column[bool][source]
property subscription: EntrySubscription[source]
directory_id: Column[uuid.UUID][source]
class directory.models.directory.EntrySubscription(recipient: EntryRecipient, token: str)[source]

Adds subscription management to a recipient.

property recipient_id: uuid.UUID[source]
confirm() bool[source]
unsubscribe() bool[source]