本文整理汇总了Python中corehq.apps.cloudcare.models.ApplicationAccess.get_template_json方法的典型用法代码示例。如果您正苦于以下问题:Python ApplicationAccess.get_template_json方法的具体用法?Python ApplicationAccess.get_template_json怎么用?Python ApplicationAccess.get_template_json使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类corehq.apps.cloudcare.models.ApplicationAccess
的用法示例。
在下文中一共展示了ApplicationAccess.get_template_json方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: app_settings
# 需要导入模块: from corehq.apps.cloudcare.models import ApplicationAccess [as 别名]
# 或者: from corehq.apps.cloudcare.models.ApplicationAccess import get_template_json [as 别名]
def app_settings(request, domain):
if request.method == 'GET':
apps = get_cloudcare_apps(domain)
access = ApplicationAccess.get_template_json(domain, apps)
groups = Group.by_domain(domain)
return render(request, 'cloudcare/config.html', {
'domain': domain,
'apps': apps,
'groups': groups,
'access': access,
})
elif request.method == 'PUT':
j = json.loads(request.raw_post_data)
old = ApplicationAccess.get_by_domain(domain)
new = ApplicationAccess.wrap(j)
old.restrict = new.restrict
old.app_groups = new.app_groups
try:
if old._rev != new._rev or old._id != new._id:
raise ResourceConflict()
old.save()
except ResourceConflict:
return HttpResponseConflict()
else:
return json_response({'_rev': old._rev})
示例2: page_context
# 需要导入模块: from corehq.apps.cloudcare.models import ApplicationAccess [as 别名]
# 或者: from corehq.apps.cloudcare.models.ApplicationAccess import get_template_json [as 别名]
def page_context(self):
apps = get_cloudcare_apps(self.domain)
access = ApplicationAccess.get_template_json(self.domain, apps)
groups = Group.by_domain(self.domain)
return {
'apps': apps,
'groups': groups,
'access': access,
}