📜  检查 djnago 信号中更改的模型字段 - 无论代码示例

📅  最后修改于: 2022-03-11 14:56:44.546000             🧑  作者: Mango

代码示例1
@receiver(post_save, sender=Mode)
def post_save(sender, instance, created, **kwargs):
    if not created:
        for item in iter(kwargs.get('update_fields')):
            if item == 'field_name' and instance.field_name == "some_value":
               # do something here