From fc8181b5edf6676079ed2d79efab4ba43baa5c9e Mon Sep 17 00:00:00 2001 From: Michael Bai Date: Mon, 13 Sep 2021 16:50:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=85=B3=E8=81=94=E4=BA=86=E8=B5=84=E4=BA=A7=E7=9A=84=E7=89=B9?= =?UTF-8?q?=E6=9D=83=E7=94=A8=E6=88=B7=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/audits/signals_handler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/audits/signals_handler.py b/apps/audits/signals_handler.py index 5ae992a95..17ff053ab 100644 --- a/apps/audits/signals_handler.py +++ b/apps/audits/signals_handler.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- # -from django.db.models.signals import post_save, post_delete, m2m_changed +from django.db.models.signals import ( + post_save, post_delete, m2m_changed, pre_delete +) from django.dispatch import receiver from django.conf import settings from django.db import transaction @@ -226,7 +228,7 @@ def on_object_created_or_update(sender, instance=None, created=False, update_fie create_operate_log(action, sender, instance) -@receiver(post_delete) +@receiver(pre_delete) def on_object_delete(sender, instance=None, **kwargs): create_operate_log(models.OperateLog.ACTION_DELETE, sender, instance)