本文整理汇总了Python中profiles.models.Profile.gender方法的典型用法代码示例。如果您正苦于以下问题:Python Profile.gender方法的具体用法?Python Profile.gender怎么用?Python Profile.gender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类profiles.models.Profile
的用法示例。
在下文中一共展示了Profile.gender方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_profile
# 需要导入模块: from profiles.models import Profile [as 别名]
# 或者: from profiles.models.Profile import gender [as 别名]
def create_profile(user, gender=None, lname=None):
if gender is None:
gender = get_random_gender()
fname = get_random_fname(gender)
if lname is None:
lname = get_random_lname()
zc = get_random_zip()
photo = adult_photo(gender)
profile = Profile()
profile.user = user
profile.first_name = fname
profile.last_name = lname
profile.zip_code = zc
profile.gender = gender
profile.save()
f = open(photo, 'r')
np = Photo(album=profile.album, caption="Profile", original_image=File(f))
np.save()
profile.set_profile_pic(np)
return profile
示例2: create_profile
# 需要导入模块: from profiles.models import Profile [as 别名]
# 或者: from profiles.models.Profile import gender [as 别名]
def create_profile(self, user=None, profile_data=None, commit=True):
profile = Profile()
if user is None:
raise NotImplementedError("SignupForm.create_profile requires a valid user")
profile.user = user
profile.first_name = profile_data["first_name"]
profile.last_name = profile_data["last_name"]
profile.zip_code = profile_data["zip_code"]
profile.gender = profile_data["gender"]
profile.source = profile_data["source"]
profile.save()
return profile
示例3: create_profile
# 需要导入模块: from profiles.models import Profile [as 别名]
# 或者: from profiles.models.Profile import gender [as 别名]
def create_profile(self, user, commit=True):
community = Community.objects.get(pk=self.cleaned_data["community"])
disease = Disease.objects.get(pk=self.cleaned_data["disease"].id)
gender = self.cleaned_data["gender"]
profile = Profile()
profile.disease = disease
profile.community = community
profile.gender = gender
profile.birth_date = self.cleaned_data["birth_date"]
profile.user = user
if commit:
profile.save()
return profile
示例4: create_profile
# 需要导入模块: from profiles.models import Profile [as 别名]
# 或者: from profiles.models.Profile import gender [as 别名]
def create_profile(user, profile_data, commit=True):
profile = Profile()
if user is None:
raise NotImplementedError("SignupForm.create_profile requires a valid user")
profile.user = user
profile.first_name = profile_data["first_name"]
profile.last_name = profile_data["last_name"]
profile.fb_account_linked = profile_data["fb_account_linked"]
profile.fb_id = profile_data["fb_id"]
profile.fb_stream_publish = profile_data["fb_stream_publish"]
profile.source = profile_data["source"]
profile.gender = profile_data["gender"]
profile.fb_login = profile_data["fb_login"]
profile.zip_code = profile_data["zip_code"]
profile.save()
return profile