本文整理汇总了Python中user.models.User.fetch_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python User.fetch_by_id方法的具体用法?Python User.fetch_by_id怎么用?Python User.fetch_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类user.models.User
的用法示例。
在下文中一共展示了User.fetch_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: reload
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import fetch_by_id [as 别名]
def reload(request, user):
# need to do it in user.middleware.AuthMiddleware
newUser = User.fetch_by_id(user.id)
request.session[USER_UID_KEY] = newUser.id
request.session[USER_EMAIL_KEY] = newUser.email
request.session[USER_NAME_KEY] = newUser.name
request.session[USER_LEVEL_KEY] = newUser.level
request.session[USER_AUTH_KEY] = True
示例2: clear_file_upload
# 需要导入模块: from user.models import User [as 别名]
# 或者: from user.models.User import fetch_by_id [as 别名]
def clear_file_upload(user_id, upload_id):
print('clear_file_upload :: start')
user = User.fetch_by_id(user_id)
FileUpload.remove(upload_id, user)
print('clear_file_upload :: done')