本文整理汇总了Python中model.user.User.from_id方法的典型用法代码示例。如果您正苦于以下问题:Python User.from_id方法的具体用法?Python User.from_id怎么用?Python User.from_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.from_id方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: userlist
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import from_id [as 别名]
def userlist(id,type):
user = User.from_id(id)
if(type == 'followers'):
list = user.followers
elif(type == 'followees'):
list = user.followees
else:
#type == 'friends'
list = user.getfriends()
return render_template('user/userlist.html',user=user,type=type,userlist=list)
示例2: dofollow
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import from_id [as 别名]
def dofollow():
try:
id = int(request.form['id'])
except KeyError:
abort(400)
followee = User.from_id(id)
if followee is None:
abort(404)
current_user.follow(followee)
followee.addnewnote(user_from=current_user.id,
type=Notification.TYPE_FOLLOW,
)
return 'done!'
示例3: profile
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import from_id [as 别名]
def profile(id):
user = User.from_id(id)
if user is None:
abort(404)
return render_template('user/profile.html', user=user)
示例4: play
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import from_id [as 别名]
def play(id):
video = Video.from_id(id)
poster = User.from_id(video.poster_id)
return render_template('video/play.html', poster=poster, video=video)
示例5: videolist
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import from_id [as 别名]
def videolist(userid):
user = User.from_id(userid)
return render_template('video/videolist.html',videolist = user.videos)