本文整理匯總了Python中model.group.Group.users方法的典型用法代碼示例。如果您正苦於以下問題:Python Group.users方法的具體用法?Python Group.users怎麽用?Python Group.users使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類model.group.Group
的用法示例。
在下文中一共展示了Group.users方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_group_by_hash
# 需要導入模塊: from model.group import Group [as 別名]
# 或者: from model.group.Group import users [as 別名]
def get_group_by_hash(self, invite_hash):
collection = self.collection
result = collection.find_one({"hash": invite_hash});
if result != None:
group = Group()
group.id = result["_id"]
# print group.id
group.name = result["name"]
group.hash = result["hash"]
group.users = result["users"]
return group
else:
return None
示例2: get_group_by_id
# 需要導入模塊: from model.group import Group [as 別名]
# 或者: from model.group.Group import users [as 別名]
def get_group_by_id(self, group_id):
# get group document from db
collection = self.collection
group_id = ObjectId(group_id)
result = collection.find_one({"_id": group_id});
if result != None:
group = Group()
group.id = group_id
# print group.id
group.name = result["name"]
group.hash = result["hash"]
group.users = result["users"]
return group
else:
return None