TypeError: Update_Profile() missing 1 required positional argument: 'self'
TypeError: Update_Profile() missing 1 required positional argument: 'self'
每当我创建超级用户时,它就会抛出一个错误
Update_Profile() missing 1 required positional argument: 'self'.
@receiver(post_save, sender=User)
def Update_Profile(self, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)
instance.user_profile.save()
应该是,(没有self
)
@receiver(post_save, sender=User)
def Update_Profile(instance, created, **kwargs):
...
每当我创建超级用户时,它就会抛出一个错误
Update_Profile() missing 1 required positional argument: 'self'.
@receiver(post_save, sender=User)
def Update_Profile(self, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)
instance.user_profile.save()
应该是,(没有self
)
@receiver(post_save, sender=User)
def Update_Profile(instance, created, **kwargs):
...