本文整理匯總了Python中account.models.UserProfile.bio方法的典型用法代碼示例。如果您正苦於以下問題:Python UserProfile.bio方法的具體用法?Python UserProfile.bio怎麽用?Python UserProfile.bio使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類account.models.UserProfile
的用法示例。
在下文中一共展示了UserProfile.bio方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: save
# 需要導入模塊: from account.models import UserProfile [as 別名]
# 或者: from account.models.UserProfile import bio [as 別名]
def save(self):
email = self.cleaned_data["email"]
first_name = self.cleaned_data["first_name"]
last_name = self.cleaned_data["last_name"]
password = self.cleaned_data["password"]
password_c = self.cleaned_data["password_c"]
bio = self.cleaned_data["bio"]
random_username = hashlib.sha224(email).hexdigest()[:30]
activation_code = hashlib.sha224(email).hexdigest()[:50]
user = User()
user.username = random_username
user.email = email
user.first_name = first_name
user.last_name = last_name
user.is_active = False
user.set_password(password)
user.save()
user_profile = UserProfile()
user_profile.bio = bio
user_profile.user = user
user_profile.activation_code = activation_code
user_profile.save()
send_user_activation_mail.delay(activation_code, email)