Hide keyboard shortcuts

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 

2 

3import inspect 

4 

5# Exports 

6 

7__all__ = ( 

8 "is_audit_model", 

9) 

10 

11# Functions 

12 

13 

14def is_audit_model(model_or_instance): 

15 """Indicates whether the given model or model instance is auditable, e.g. it extends ``AuditMixin``. 

16 

17 :param model_or_instance: The model (class) or instance to be checked. 

18 

19 :rtype: bool 

20 

21 """ 

22 from .mixins import AuditMixin 

23 

24 if inspect.isclass(model_or_instance) and issubclass(model_or_instance, AuditMixin): 

25 return True 

26 

27 if isinstance(model_or_instance, AuditMixin): 

28 return True 

29 

30 return False