每當我創(chuàng)建超級用戶時,它都會給我一個錯誤 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()
1 回答

開滿天機
TA貢獻1786條經(jīng)驗 獲得超13個贊
它應該是,(沒有self)
@receiver(post_save, sender=User)
def Update_Profile(instance, created, **kwargs):
...
添加回答
舉報
0/150
提交
取消