Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Imports
3import inspect
5# Exports
7__all__ = (
8 "is_audit_model",
9)
11# Functions
14def is_audit_model(model_or_instance):
15 """Indicates whether the given model or model instance is auditable, e.g. it extends ``AuditMixin``.
17 :param model_or_instance: The model (class) or instance to be checked.
19 :rtype: bool
21 """
22 from .mixins import AuditMixin
24 if inspect.isclass(model_or_instance) and issubclass(model_or_instance, AuditMixin):
25 return True
27 if isinstance(model_or_instance, AuditMixin):
28 return True
30 return False