directory.collections.directory_entry

Module Contents

Classes

DirectorySearchWidget

DirectoryEntryCollection

Provides a view on a directory's entries.

Attributes

T

DirectoryEntryT

class directory.collections.directory_entry.DirectorySearchWidget[source]

Bases: Protocol[DirectoryEntryT]

property name: str[source]
property search_query: sqlalchemy.orm.Query[DirectoryEntryT][source]
adapt(query: sqlalchemy.orm.Query[DirectoryEntryT]) sqlalchemy.orm.Query[DirectoryEntryT][source]
directory.collections.directory_entry.T[source]
directory.collections.directory_entry.DirectoryEntryT[source]
class directory.collections.directory_entry.DirectoryEntryCollection(directory: onegov.directory.models.Directory, type: str = '*', keywords: Mapping[str, list[str]] | None = None, page: int = 0, search_widget: DirectorySearchWidget[DirectoryEntryT] | None = None)[source]

Bases: onegov.core.collection.GenericCollection[DirectoryEntryT], onegov.core.collection.Pagination[DirectoryEntryT]

Provides a view on a directory’s entries.

The directory itself might be a natural place for lots of these methods to reside, but ultimately we want to avoid mixing the concerns of the directory model and this view-supporting collection.

property search: str | None[source]
property search_query: Query[DirectoryEntryT] | None[source]
property page_index: int[source]

Returns the current page index (starting at 0).

property directory_name: str[source]
property model_class: type[DirectoryEntryT][source]
__eq__(other: object) bool[source]

Return self==value.

subset() Query[DirectoryEntryT][source]

Returns an SQLAlchemy query containing all records that should be considered for pagination.

page_by_index(index: int) typing_extensions.Self[source]

Returns the page at the given index. A page here means an instance of the class inheriting from the Pagination base class.

by_name(name: str) DirectoryEntryT | None[source]
query() Query[DirectoryEntryT][source]
valid_keywords(parameters: Mapping[str, T]) dict[str, T][source]
available_filters(sort_choices: bool = False, sortfunc: Callable[[str], SupportsRichComparison] | None = None) Iterable[tuple[str, str, list[str]]][source]

Retrieve the filters with their choices.

By default the choices are returned in the same order as defined in the structrue. To filter alphabetically, set sort_choices=True.

for_keywords(singular: bool = False, **keywords: list[str]) typing_extensions.Self[source]
for_toggled_keyword_value(keyword: str, value: str, singular: bool = False) typing_extensions.Self[source]
without_keywords() typing_extensions.Self[source]