本文整理匯總了Python中corehq.apps.builds.models.BuildSpec.wrap方法的典型用法代碼示例。如果您正苦於以下問題:Python BuildSpec.wrap方法的具體用法?Python BuildSpec.wrap怎麽用?Python BuildSpec.wrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類corehq.apps.builds.models.BuildSpec
的用法示例。
在下文中一共展示了BuildSpec.wrap方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: commcare_version_report
# 需要導入模塊: from corehq.apps.builds.models import BuildSpec [as 別名]
# 或者: from corehq.apps.builds.models.BuildSpec import wrap [as 別名]
def commcare_version_report(request, template="hqadmin/commcare_version.html"):
apps = get_db().view("app_manager/applications_brief").all()
menu = CommCareBuildConfig.fetch().menu
builds = [item.build.to_string() for item in menu]
by_build = dict([(item.build.to_string(), {"label": item.label, "apps": []}) for item in menu])
for app in apps:
app = app["value"]
app["id"] = app["_id"]
if app.get("build_spec"):
build_spec = BuildSpec.wrap(app["build_spec"])
build = build_spec.to_string()
if by_build.has_key(build):
by_build[build]["apps"].append(app)
else:
by_build[build] = {"label": build_spec.get_label(), "apps": [app]}
builds.append(build)
tables = []
for build in builds:
by_build[build]["build"] = build
tables.append(by_build[build])
context = get_hqadmin_base_context(request)
context.update({"tables": tables})
context["hide_filters"] = True
return render(request, template, context)