本文整理汇总了Python中model.user.User.get_by_pk方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_pk方法的具体用法?Python User.get_by_pk怎么用?Python User.get_by_pk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.get_by_pk方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_pk [as 别名]
def post(self):
user_id = self.get_argument('user_id', None)
user = MUser.get_by_pk(user_id)
if user:
code = self.work_with_user(user)
else:
code = -1
self.finish(json.dumps({'code': code}))
示例2: get
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_pk [as 别名]
def get(self, index):
index = int(index)
if index not in Rolls:
self.write_error(404)
else:
data = Rolls[index]
max_point = -1
for i in data['points']:
if i['point'] > max_point:
max_point = i['point']
self.render(data=data, author=User.get_by_pk(data['host']), max_point=max_point)
示例3: get_object
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_pk [as 别名]
def get_object(cls, related_type, related_id):
from model.user import User
from model.topic import Topic
from model.wiki import WikiItem
if related_type == OBJECT_TYPES.USER:
u = User.get_by_pk(related_id)
if u: return u
elif related_type == OBJECT_TYPES.TOPIC:
t = Topic.get_by_pk(related_id)
if t: return t
elif related_type == OBJECT_TYPES.WIKI:
w = WikiItem.get_by_pk(related_id)
if w: return w