本文整理汇总了Python中models.user.User.gender方法的典型用法代码示例。如果您正苦于以下问题:Python User.gender方法的具体用法?Python User.gender怎么用?Python User.gender使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.gender方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_user
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import gender [as 别名]
def create_user(self, data):
try:
province =self.provinces[data[1]]
except:
province=0
u=User()
u.uid=data[0]
u.province=data[1]
u.gender=data[2]
u.verified=data[3]
u.save() # store to mongo
示例2: create_test_user
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import gender [as 别名]
def create_test_user():
facebook_id = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
user = User()
user.name = 'Rafael Goncalves'
user.facebook_id = facebook_id
user.birthday = date.today()
user.friends = 299
user.gender = 'male'
user.platform = USER_PLATFORM_iOS
user.email = '[email protected]'
db.session.add(user)
db.session.commit()
token = Token(user.id)
db.session.add(token)
db.session.commit()
return user
示例3: get
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import gender [as 别名]
def get(self):
code = self.get_argument("code", False)
#@todo: catch AuthError
if not code:
yield self.authorize_redirect(redirect_uri=self._get_redirect_uri(),
client_id=self._authSettings['client_id'])
else:
vk_user = yield self.get_authenticated_user(redirect_uri=self._get_redirect_uri(),
client_id=self._authSettings['client_id'],
client_secret=self._authSettings['client_secret'],
code=code)
user = yield User.get_by_external_id(self.db, vk_user['uid'])
user = User(self.db) if user is None else user
user.external_id = vk_user['uid']
user.city_id = vk_user['city']
user.city_name = 'foooo'
user.gender = vk_user['sex']
user.profile = {'first_name': vk_user['first_name'],
'last_name': vk_user['last_name'],
'user_pic_small': vk_user['photo_50'],
'user_pic_big': vk_user['photo_max_orig']}
yield user.save()
self.set_secure_cookie('uid', str(user.id))
self.redirect('/')
示例4: create_data
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import gender [as 别名]
def create_data():
#create some users
facebook_id = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
rafael = User()
rafael.name = 'Rafael Goncalves'
rafael.facebook_id = facebook_id
rafael.birthday = date.today()
rafael.friends = 299
rafael.gender = 'male'
rafael.nickname = 'rafael'
rafael.email = '[email protected]'
db.session.add(rafael)
token = Token(rafael.id)
db.session.commit()
facebook_id2 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
bola = User()
bola.name = 'Bola Domingues'
bola.facebook_id = facebook_id2
bola.birthday = date.today()
bola.friends = 532
bola.gender = 'male'
bola.nickname = 'bola'
bola.email = '[email protected]'
db.session.add(bola)
token = Token(bola.id)
db.session.commit()
facebook_id3 = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
bolovo = User()
bolovo.name = 'Doutor Bolovo'
bolovo.facebook_id = facebook_id3
bolovo.birthday = date.today()
bolovo.friends = 23
bolovo.gender = 'male'
bolovo.nickname = 'bolovo'
bolovo.email = '[email protected]'
db.session.add(bolovo)
token = Token(bolovo.id)
db.session.commit()
#create some groups
share_t = Group()
share_t.active = True
share_t.title = "Share Your Thoughts"
share_t.description = "Grupo copiado do facebook chamado share-your-thoughts"
share_t.admins.append(bola)
share_t.subscriptions.append(bola)
share_t.subscriptions.append(bolovo)
share_t.subscriptions.append(rafael)
db.session.add(share_t)
db.session.commit()
shammu = Group()
shammu.active = True
shammu.title = "Salvem as Baleias!"
shammu.description = "Grupo dedicado ao salvamento de baleias e o fechamentos de parques de entretenimento que usam animais em cativeiro para estrelar em suas atracoes"
shammu.admins.append(bola)
shammu.subscriptions.append(bolovo)
shammu.subscriptions.append(bola)
db.session.add(shammu)
db.session.commit()
share_c = Group()
share_c.active = True
share_c.title = "Share Your Career"
share_c.description = "Grupo dedicado ao compartilhamento de informacoes sobre estagios, empregos e carreiras em geral"
share_c.admins.append(bolovo)
share_c.subscriptions.append(bolovo)
share_c.subscriptions.append(rafael)
share_c.subscriptions.append(bola)
db.session.add(share_c)
db.session.commit()
#create some posts to share_t
share_t_post1 = Post('E possivel a contratacao de anoes para animar festar de criancas acima de 11 anos?', 0)
share_t_post1.group_id = bola.id
share_t_post1.user_id = share_t.id
db.session.add(share_t_post1)
db.session.commit()
share_t_post2 = Post('Algo para fazer esse fds??? Geoconda ta com nada me disseram migas!', 0)
share_t_post2.group_id = bolovo.id
share_t_post2.user_id = share_t.id
db.session.add(share_t_post2)
db.session.commit()
#create some posts to share_t
share_c_post1 = Post('[PUC][FACULDADE] Puc ou mackenzie!!!??', 0)
share_c_post1.group_id = bolovo.id
share_c_post1.user_id = share_c.id
db.session.add(share_c_post1)
db.session.commit()
share_c_post2 = Post('[EMPREGO][ENTREVISTA] Como e fazer uma entrevista no JPMorgan gente?', 0)
share_c_post2.group_id = bolovo.id
share_c_post2.user_id = share_c.id
db.session.add(share_c_post2)
db.session.commit()
#.........这里部分代码省略.........