# Imports
import inspect
# Exports
__all__ = (
"is_audit_model",
)
# Functions
[docs]def is_audit_model(model_or_instance):
"""Indicates whether the given model or model instance is auditable, e.g. it extends ``AuditMixin``.
:param model_or_instance: The model (class) or instance to be checked.
:rtype: bool
"""
from .mixins import AuditMixin
if inspect.isclass(model_or_instance) and issubclass(model_or_instance, AuditMixin):
return True
if isinstance(model_or_instance, AuditMixin):
return True
return False