[Answered ]-How to execute code on save in Django User model?

2👍

You’re looking for this Signal

from django.db.models.signals import pre_save
from django.contrib.auth.models import User

def do_your_thing(sender, instance, **kwargs):
    # Do something
    print(instance)

pre_save.connect(do_your_thing, sender=User)

Leave a comment