core.orm
¶
Subpackages¶
Submodules¶
Package Contents¶
Functions¶
|
Finds the ORM models in the given ORM base class that match a filter. |
Attributes¶
- core.orm.find_models(base: type[_T], is_match: Callable[[type[_T]], bool]) Iterator[type[_T]] [source]¶
Finds the ORM models in the given ORM base class that match a filter.
The filter is called with each class in the instance and it is supposed to return True if it matches.
For example, find all SQLAlchemy models that use
ContentMixin
:from onegov.core.orm.mixins import ContentMixin find_models(base, is_match=lambda cls: issubclass(cls, ContentMixin))