Answers for "check for changed model fields in djnago signal"

0

check for changed model fields in djnago signal

@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
Posted by: Guest on June-17-2021

Browse Popular Code Answers by Language