本文整理汇总了Python中corehq.apps.orgs.models.Team.get_by_domain方法的典型用法代码示例。如果您正苦于以下问题:Python Team.get_by_domain方法的具体用法?Python Team.get_by_domain怎么用?Python Team.get_by_domain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.orgs.models.Team
的用法示例。
在下文中一共展示了Team.get_by_domain方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apply_teams_to_users
# 需要导入模块: from corehq.apps.orgs.models import Team [as 别名]
# 或者: from corehq.apps.orgs.models.Team import get_by_domain [as 别名]
def apply_teams_to_users(self, web_users):
teams = Team.get_by_domain(self.domain)
for team in teams:
for user in team.get_members():
if user.get_id not in [web_user.get_id for web_user in web_users]:
user.from_team = True
web_users.append(user)
for user in web_users:
user.current_domain = self.domain
示例2: web_users
# 需要导入模块: from corehq.apps.orgs.models import Team [as 别名]
# 或者: from corehq.apps.orgs.models.Team import get_by_domain [as 别名]
def web_users(self):
web_users = WebUser.by_domain(self.domain)
teams = Team.get_by_domain(self.domain)
for team in teams:
for user in team.get_members():
if user.get_id not in [web_user.get_id for web_user in web_users]:
user.from_team = True
web_users.append(user)
for user in web_users:
user.current_domain = self.domain
return web_users
示例3: web_users
# 需要导入模块: from corehq.apps.orgs.models import Team [as 别名]
# 或者: from corehq.apps.orgs.models.Team import get_by_domain [as 别名]
def web_users(self):
web_users = WebUser.by_domain(self.domain)
teams = Team.get_by_domain(self.domain)
for team in teams:
for user in team.get_members():
if user.get_id not in [web_user.get_id for web_user in web_users]:
user.from_team = True
web_users.append(user)
for user in web_users:
user.current_domain = self.domain
web_users.sort(key=lambda x: (x.role_label(), x.email))
return web_users
示例4: _users_context
# 需要导入模块: from corehq.apps.orgs.models import Team [as 别名]
# 或者: from corehq.apps.orgs.models.Team import get_by_domain [as 别名]
def _users_context(request, domain):
couch_user = request.couch_user
web_users = WebUser.by_domain(domain)
teams = Team.get_by_domain(domain)
for team in teams:
for member_id in team.member_ids:
team_user = WebUser.get(member_id)
if team_user.get_id not in [web_user.get_id for web_user in web_users]:
web_users.append(team_user)
for user in [couch_user] + list(web_users):
user.current_domain = domain
return {
'web_users': web_users,
'domain': domain,
'couch_user': couch_user,
}
示例5: org_settings
# 需要导入模块: from corehq.apps.orgs.models import Team [as 别名]
# 或者: from corehq.apps.orgs.models.Team import get_by_domain [as 别名]
def org_settings(request, domain):
domain = Domain.get_by_name(domain)
org_users = []
teams = Team.get_by_domain(domain.name)
for team in teams:
for user in team.get_members():
user.team_id = team.get_id
user.team = team.name
org_users.append(user)
for user in org_users:
user.current_domain = domain.name
return render(request, 'domain/orgs_settings.html', {
"project": domain, 'domain': domain.name,
"organization": Organization.get_by_name(getattr(domain, "organization", None)),
"org_users": org_users
})
示例6: page_context
# 需要导入模块: from corehq.apps.orgs.models import Team [as 别名]
# 或者: from corehq.apps.orgs.models.Team import get_by_domain [as 别名]
def page_context(self):
domain = self.domain_object
org_users = []
teams = Team.get_by_domain(domain.name)
for team in teams:
for user in team.get_members():
user.team_id = team.get_id
user.team = team.name
org_users.append(user)
for user in org_users:
user.current_domain = domain.name
all_orgs = Organization.get_all()
return {
"project": domain,
'domain': domain.name,
"organization": Organization.get_by_name(getattr(domain, "organization", None)),
"org_users": org_users,
"all_orgs": all_orgs,
}