django : How to use signals?

后端 未结 1 1726

After creating a user account with this model:

class User(auth.models.User, auth.models.PermissionsMixin):

    def __str_         


        
1条回答
  •  梦毁少年i
    2021-01-28 03:21

    Its too simple. you can write your saving history code here:

    def send_data(sender, instance, created, **kwargs):
        from your_app.models import History
        history = History()
        history.employee_ID = instance.username
        history.name = instance.first_name
        ....
        history.save()
    

    0 讨论(0)
提交回复
热议问题