本文整理汇总了Python中db.User.find_one方法的典型用法代码示例。如果您正苦于以下问题:Python User.find_one方法的具体用法?Python User.find_one怎么用?Python User.find_one使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db.User
的用法示例。
在下文中一共展示了User.find_one方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import find_one [as 别名]
def get(self, name):
user = User.find_one({"user_domain": name})
user.user_say = markdown2.markdown(user.user_say)
user.user_jointime = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(user.user_jointime))
likenum = User.find({"user_id": user._id}).count()
user.gravatar = get_avatar(user.user_email, 100)
self.render("userhome.html", user=user, likenum=likenum)
示例2: post
# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import find_one [as 别名]
def post(self):
email = self.get_argument("email", "")
doc = User.find_one({"user_email": email})
if doc:
emailverify = str(utils.make_emailverify())
doc.emailverify = emailverify
doc.save()
self.send_resetpass_email(emailverify, email)
self.render("forgotpass_sent.html")
示例3: get
# 需要导入模块: from db import User [as 别名]
# 或者: from db.User import find_one [as 别名]
def get(self, name):
user = User.find_one({'user_domain': name})
user.user_jointime = time.strftime(
'%Y-%m-%d %H:%M:%S', time.localtime(user.user_jointime))
likes = User.find({'user_id': user._id})
likenum = likes.count()
for like in likes:
share = Share.by_id(like.share_id)
like.title = share.title
like.id = share.id
like.type = share.sharetype
user.gravatar = get_avatar(user.user_email, 100)
self.render("userlike.html", user=user, likenum=likenum, likes=likes)