本文整理汇总了Python中profiles.models.Profile.owner_username方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.owner_username方法的具体用法?Python Profile.owner_username怎么用?Python Profile.owner_username使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profiles.models.Profile
的用法示例。
在下文中一共展示了Profile.owner_username方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save
# 需要导入模块: from profiles.models import Profile [as 别名]
# 或者: from profiles.models.Profile import owner_username [as 别名]
def save(self, profile_callback=None):
#
#new_user = RegistrationProfile.objects.create_inactive_user(username=self.cleaned_data['username'],
# password=self.cleaned_data['password1'],
# create inactive user email=self.cleaned_data['email'])
new_user = User.objects.create_user(self.cleaned_data['username'],
self.cleaned_data['email'],
self.cleaned_data['password1'])
new_user.first_name = self.cleaned_data['first_name']
new_user.last_name = self.cleaned_data['last_name']
new_user.is_active = False
new_user.save()
# create registration profile
registration_profile = RegistrationProfile.objects.create_profile(new_user)
send_registration_activation_email(new_user, registration_profile)
new_profile = Profile(user=new_user,
email=self.cleaned_data['email'],
company=self.cleaned_data['company'],
phone=self.cleaned_data['phone'],
address=self.cleaned_data['address'],
city=self.cleaned_data['city'],
state=self.cleaned_data['state'],
country=self.cleaned_data['country'],
zipcode=self.cleaned_data['zipcode'],
)
user_hide_default = get_setting('module', 'users', 'usershidedefault')
if user_hide_default:
new_profile.hide_in_search = 1
new_profile.hide_address = 1
new_profile.hide_email = 1
new_profile.hide_phone = 1
new_profile.creator = new_user
new_profile.creator_username = new_user.username
new_profile.owner = new_user
new_profile.owner_username = new_user.username
new_profile.save()
return new_user