diff --git a/app/core/models/audit.py b/app/core/models/audit.py index e6f076fe..512115fc 100644 --- a/app/core/models/audit.py +++ b/app/core/models/audit.py @@ -145,21 +145,21 @@ class CenturionAudit( Fail (bool): History fields not populated """ - if not hasattr(model, 'before'): + if not hasattr(model, '_before'): raise ValidationError( code = 'model_missing_before_data', message = 'Unable to save model history as the "before" data is missing.' ) - if not hasattr(model, 'after'): + if not hasattr(model, '_after'): raise ValidationError( code = 'model_missing_after_data', message = 'Unable to save model history as the "after" data is missing.' ) - if model.before == model.after: + if model._before == model._after: raise ValidationError( code = 'before_and_after_same', diff --git a/app/core/signal/audit_history.py b/app/core/signal/audit_history.py index 92f60c18..47243940 100644 --- a/app/core/signal/audit_history.py +++ b/app/core/signal/audit_history.py @@ -13,7 +13,7 @@ from core.middleware.get_request import get_request @receiver(post_save, dispatch_uid="audit_history_save") def audit_history(sender, instance, **kwargs): - if getattr(instance, 'audit_enabled', False): + if getattr(instance, '_audit_enabled', False): audit_model = apps.get_model( instance._meta.object_name + 'AuditHistory')