def create_profile(sender, instance, **kwargs):
new_account = False
if kwargs['created']:
profile = Profile.objects.create(user=instance)
new_account = True
else:
profile = Profile.objects.filter(user=instance)
if len(profile) == 0:
profile = Profile.objects.create(user=instance)
new_account = True
if new_account:
profile.update_code()
link_text = settings.HOSTNAME + profile.get_confirmation_link()
if not settings.TESTING:
send_signup_email(instance.email, link_text)
评论列表
文章目录