本文整理汇总了Python中the_tale.accounts.friends.prototypes.FriendshipPrototype.get_candidates_for方法的典型用法代码示例。如果您正苦于以下问题:Python FriendshipPrototype.get_candidates_for方法的具体用法?Python FriendshipPrototype.get_candidates_for怎么用?Python FriendshipPrototype.get_candidates_for使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类the_tale.accounts.friends.prototypes.FriendshipPrototype
的用法示例。
在下文中一共展示了FriendshipPrototype.get_candidates_for方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: candidates
# 需要导入模块: from the_tale.accounts.friends.prototypes import FriendshipPrototype [as 别名]
# 或者: from the_tale.accounts.friends.prototypes.FriendshipPrototype import get_candidates_for [as 别名]
def candidates(self):
candidates = FriendshipPrototype.get_candidates_for(self.account)
accounts_ids = [account.id for account in candidates]
clans_ids = [model.clan_id for model in candidates]
heroes = {hero.account_id: hero for hero in heroes_logic.load_heroes_by_account_ids(accounts_ids)}
clans = {clan.id: clan for clan in ClanPrototype.get_list_by_id(clans_ids)}
return self.template(
"friends/friends_candidates.html", {"candidates": candidates, "heroes": heroes, "clans": clans}
)
示例2: candidates
# 需要导入模块: from the_tale.accounts.friends.prototypes import FriendshipPrototype [as 别名]
# 或者: from the_tale.accounts.friends.prototypes.FriendshipPrototype import get_candidates_for [as 别名]
def candidates(self):
candidates = FriendshipPrototype.get_candidates_for(self.account)
accounts_ids = [account.id for account in candidates]
clans_ids = [ model.clan_id for model in candidates]
heroes = dict( (model.account_id, HeroPrototype(model=model)) for model in Hero.objects.filter(account_id__in=accounts_ids))
clans = {clan.id:clan for clan in ClanPrototype.get_list_by_id(clans_ids)}
return self.template('friends/friends_candidates.html',
{'candidates': candidates,
'heroes': heroes,
'clans': clans})
示例3: friends
# 需要导入模块: from the_tale.accounts.friends.prototypes import FriendshipPrototype [as 别名]
# 或者: from the_tale.accounts.friends.prototypes.FriendshipPrototype import get_candidates_for [as 别名]
def friends(self):
friends = FriendshipPrototype.get_friends_for(self.account)
candidates = FriendshipPrototype.get_candidates_for(self.account)
accounts_ids = [account.id for account in friends]
clans_ids = [ model.clan_id for model in friends]
heroes = {hero.account_id: hero for hero in heroes_logic.load_heroes_by_account_ids(accounts_ids)}
clans = {clan.id:clan for clan in ClanPrototype.get_list_by_id(clans_ids)}
return self.template('friends/friends_list.html',
{'friends': friends,
'candidates': candidates,
'heroes': heroes,
'clans': clans})