django signal

1 @receiver(post_save, sender=User)
2 def create_account(sender, instance=None, **kwargs):
3     if instance is None:
4         return
5     ytuser, created = YTUser.objects.get_or_create(user=instance)

 

你可能感兴趣的:(django)