本文整理汇总了Python中models.user.User.first_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.first_name方法的具体用法?Python User.first_name怎么用?Python User.first_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.first_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: google_login
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import first_name [as 别名]
def google_login(email, first, last):
user1 = User()
qry = User.query(User.email == email, User.first_name == first, User.last_name == last).get()
logging.info(qry)
if qry:
return qry.key.id()
else:
user1.email = email
user1.first_name = first
user1.last_name = last
token = user1.put()
return token.id()
示例2: set_user_details
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import first_name [as 别名]
def set_user_details(fb_id, name, last_name, email):
user1 = User()
qry = user1.check_fb_logged_in(fb_id)
if not qry:
user1.fb_id = fb_id
user1.first_name = name
user1.last_name = last_name
user1.email = email
id = user1.put()
return id.id()
else:
return qry.key.id()
示例3: register
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import first_name [as 别名]
def register(email, hashed_password, first, last):
user1 = User()
qry = User.query(User.email==email, User.password==hashed_password, User.first_name==first, User.last_name==last).get()
logging.info(qry)
if qry:
return 2
qry = user1.check_user_exist_by_email(email)
try:
qry.password = hashed_password
token = qry.put()
return token.id()
except:
user1.email = email
user1.password = hashed_password
user1.first_name = first
user1.last_name = last
token = user1.put()
return token.id()
示例4: get_user
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import first_name [as 别名]
def get_user(id=None):
from models.user import UserSmallForm
if 'logged_in' not in session:
return redirect(url_for('welcome'))
user = User(id=id)
if request.method == 'POST':
user.first_name = request.form.get('first_name', None)
user.last_name = request.form.get('last_name', None)
user.email = request.form.get('email', None)
user.update_user()
user = user.get_by_id()
form = UserSmallForm(obj=user)
schedule = Schedule(uid=id)
schedules = schedule.get_by_logged_user(user.username, timeadapt=True)
return render_template('user.html', user=user, form=form,
schedules=schedules)
示例5: print
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import first_name [as 别名]
#!/usr/bin/python3
import sys
import os
sys.path.insert(1, os.path.join(os.path.split(__file__)[0], '../../..'))
from models import storage
from models.base_model import BaseModel
from models.user import User
all_objs = storage.all()
print("-- Reloaded objects --")
for obj_id in all_objs.keys():
obj = all_objs[obj_id]
print(obj)
print("-- Create a new User --")
my_user = User()
my_user.first_name = "Betty"
my_user.last_name = "Holberton"
my_user.email = "[email protected]"
my_user.password = "root"
my_user.save()
print(my_user)