本文整理汇总了Python中appliances.models.Template.ga_version方法的典型用法代码示例。如果您正苦于以下问题:Python Template.ga_version方法的具体用法?Python Template.ga_version怎么用?Python Template.ga_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类appliances.models.Template
的用法示例。
在下文中一共展示了Template.ga_version方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: versions_for_group
# 需要导入模块: from appliances.models import Template [as 别名]
# 或者: from appliances.models.Template import ga_version [as 别名]
def versions_for_group(request):
if not request.user.is_authenticated():
return go_home(request)
group_id = request.POST.get("stream")
latest_version = None
preconfigured = request.POST.get("preconfigured", "false").lower() == "true"
container = request.POST.get("container", "false").lower() == "true"
container_q = ~Q(container=None) if container else Q(container=None)
if group_id == "<None>":
versions = []
group = None
else:
try:
group = Group.objects.get(id=group_id)
except ObjectDoesNotExist:
versions = []
else:
versions = [
(version, Template.ga_version(version))
for version in Template.get_versions(
container_q,
template_group=group, ready=True, usable=True, exists=True,
preconfigured=preconfigured, provider__working=True, provider__disabled=False,
provider__user_groups__in=request.user.groups.all())]
if versions:
if versions[0][1]:
latest_version = '{} (GA)'.format(versions[0][0])
else:
latest_version = versions[0][0]
return render(request, 'appliances/_versions.html', locals())
示例2: versions_for_group
# 需要导入模块: from appliances.models import Template [as 别名]
# 或者: from appliances.models.Template import ga_version [as 别名]
def versions_for_group(request):
group_id = request.POST.get("stream")
template_type = request.POST.get("template_type")
latest_version = None
preconfigured = request.POST.get("preconfigured", "false").lower() == "true"
if group_id == "<None>":
versions = []
group = None
else:
try:
group = Group.objects.get(id=group_id)
except ObjectDoesNotExist:
versions = []
else:
filters = {
'template_group': group,
'ready': True,
'usable': True,
'exists': True,
'provider__working': True,
'provider__disabled': False,
'provider__user_groups__in': request.user.groups.all(),
'preconfigured': preconfigured,
'template_type': template_type
}
versions = [
(version, Template.ga_version(version))
for version in Template.get_versions(**filters)]
if versions:
if versions[0][1]:
latest_version = '{} (GA)'.format(versions[0][0])
else:
latest_version = versions[0][0]
return render(request, 'appliances/_versions.html', locals())