本文整理汇总了Python中models.user.User.get_user_name方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_user_name方法的具体用法?Python User.get_user_name怎么用?Python User.get_user_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.user.User
的用法示例。
在下文中一共展示了User.get_user_name方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_groups
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_name [as 别名]
def get_groups():
appid = request.appid
uid = request.uid
groups = Group.get_groups(g._db, appid, uid)
fields = request.args.get("fields", '')
fields = fields.split(",")
for obj in groups:
gid = obj['id']
if "members" in fields:
members = Group.get_group_members(g._db, gid)
for m in members:
name = User.get_user_name(g.rds, appid, m['uid'])
m['name'] = name if name else ''
if not m.get('nickname'):
m['nickname'] = ""
obj['members'] = members
if "quiet" in fields:
q = User.get_group_do_not_disturb(g.rds, appid, uid, gid)
obj['do_not_disturb'] = bool(q)
resp = {"data":groups}
return make_response(200, resp)
示例2: leave_group_member
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_name [as 别名]
def leave_group_member(gid, memberid):
appid = request.appid
group = Group.get_group(g._db, gid)
if not group:
raise ResponseMeta(400, "group non exists")
name = User.get_user_name(g.rds, appid, memberid)
m = {"uid":memberid}
if name:
m['name'] = name
remove_group_member(appid, gid, group['name'], m)
resp = {"success":True}
return make_response(200, resp)
示例3: get_group
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_name [as 别名]
def get_group(gid):
appid = request.appid
uid = request.uid
obj = Group.get_group(g._imdb, gid)
members = Group.get_group_members(g._imdb, gid)
for m in members:
name = User.get_user_name(g.rds, appid, uid)
m['name'] = name if name else ''
obj['members'] = members
q = User.get_user_notification_quiet(g.rds, appid, uid, gid)
obj['quiet'] = bool(q)
resp = {"data":obj}
return make_response(200, resp)
示例4: get_group
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_name [as 别名]
def get_group(gid):
appid = request.appid
uid = request.uid
obj = Group.get_group(g._db, gid)
members = Group.get_group_members(g._db, gid)
for m in members:
name = User.get_user_name(g.rds, appid, m['uid'])
m['name'] = name if name else ''
if not m.get('nickname'):
m['nickname'] = ""
obj['members'] = members
q = User.get_group_do_not_disturb(g.rds, appid, uid, gid)
obj['do_not_disturb'] = bool(q)
resp = {"data":obj}
return make_response(200, resp)
示例5: get_groups
# 需要导入模块: from models.user import User [as 别名]
# 或者: from models.user.User import get_user_name [as 别名]
def get_groups():
appid = request.appid
uid = request.uid
groups = Group.get_groups(g._imdb, appid, uid)
fields = request.args.get("fields", '')
fields = fields.split(",")
for obj in groups:
gid = obj['id']
if "members" in fields:
members = Group.get_group_members(g._imdb, gid)
for m in members:
name = User.get_user_name(g.rds, appid, uid)
m['name'] = name if name else ''
obj['members'] = members
if "quiet" in fields:
q = User.get_user_notification_quiet(g.rds, appid, uid, gid)
obj['quiet'] = bool(q)
resp = {"data":groups}
return make_response(200, resp)