本文整理汇总了Python中model.user.User.select_one方法的典型用法代码示例。如果您正苦于以下问题:Python User.select_one方法的具体用法?Python User.select_one怎么用?Python User.select_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.select_one方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: about
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import select_one [as 别名]
def about():
user = User.select_one()
if not user:
logging.info("not found user")
return abort(500)
labels, has_login = _prepare_base_data()
return render_template('/frontend/about.html',
user=user,
labels=labels,
has_login=has_login
)
示例2: selfinfo
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import select_one [as 别名]
def selfinfo():
username = session.get("username", "")
email = session.get("email", None)
error = {}
if request.method == "POST":
logging.info("backend selfinfo post method")
github = request.form["github"]
signature = request.form["signature"]
introduce = request.form["introduce"]
if len(github) > 50:
error["github"] = u"github长度超过限制"
if len(signature) > 200:
error["signature"] = u"个性签名长度超过限制"
if len(introduce) > 200:
error["introduce"] = u"自我介绍长度超过限制"
email = session.get("email", None)
if not error and email is not None:
User(email=email).update(github=github, signature=signature, introduce=introduce)
user = User.select_one(where={"email": email})
return render_template("/backend/selfinfo.html", user=user, error=error, username=username)