From 94c026f23f2b01ee2b0b8b183b1b865c26152959 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 18 Dec 2023 10:25:48 +0800 Subject: [PATCH] feat: create_auditlog bug --- apps/monitor/services.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/apps/monitor/services.py b/apps/monitor/services.py index 592c646e..00cfbe49 100644 --- a/apps/monitor/services.py +++ b/apps/monitor/services.py @@ -37,6 +37,7 @@ def create_auditlog(action: str, instance, val_new: dict, val_old: dict = None, change_user_l = change_user if change_user else instance.update_by change_time_l = change_time if change_time else instance.update_time else: + has_changed = True change_user_l = change_user change_time_l = change_time for k, v in val_new.items(): @@ -47,8 +48,6 @@ def create_auditlog(action: str, instance, val_new: dict, val_old: dict = None, elif not compare_values(val_new.get(k), val_old.get(k), ignore_order=True): difference.append( {'field': k, 'action': 'update', 'val_old': val_old[k], 'val_new': v}) - if difference: - has_changed = True if has_changed: AuditLog.objects.create( action=action,