directory.models.directory
Attributes
Classes
Create a collection of name/value pairs. |
|
A general file (image, document, pdf, etc), referenced in the database. |
|
A directory of entries that share a common data structure. For example, |
|
Represents a single recipient. |
|
Adds subscription management to a recipient. |
Module Contents
- 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.
- 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.
- linked_directory_entries: sqlalchemy.orm.relationship[list[directory.models.directory_entry.DirectoryEntry]][source]
- property directory_entry: directory.models.directory_entry.DirectoryEntry | None[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.
- 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.
- 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.
- entries: sqlalchemy.orm.relationship[list[directory.models.directory_entry.DirectoryEntry]][source]
- property entry_cls: type[directory.models.directory_entry.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: collections.abc.Mapping[str, Any], set_name: bool = False, force_update: bool = False) directory.models.directory_entry.DirectoryEntry [source]
- structure_configuration_observer(structure: str, configuration: directory.types.DirectoryConfiguration) None [source]
- migration(new_structure: str, new_configuration: directory.types.DirectoryConfiguration) onegov.directory.migration.DirectoryMigration [source]
- class directory.models.directory.EntryRecipient[source]
Bases:
onegov.core.orm.Base
,onegov.core.orm.mixins.TimestampMixin
Represents a single recipient.
- property subscription: EntrySubscription[source]