当前位置: 首页>>代码示例>>Python>>正文


Python Provider.complete_user_usage方法代码示例

本文整理汇总了Python中appliances.models.Provider.complete_user_usage方法的典型用法代码示例。如果您正苦于以下问题:Python Provider.complete_user_usage方法的具体用法?Python Provider.complete_user_usage怎么用?Python Provider.complete_user_usage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在appliances.models.Provider的用法示例。


在下文中一共展示了Provider.complete_user_usage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: providers

# 需要导入模块: from appliances.models import Provider [as 别名]
# 或者: from appliances.models.Provider import complete_user_usage [as 别名]
def providers(request, provider_id=None):
    if provider_id is None:
        try:
            return redirect(
                "specific_provider", provider_id=Provider.objects.order_by("id")[0].id)
        except IndexError:
            # No Provider
            messages.info(request, "No provider present, redirected to the homepage.")
            return go_home(request)
    else:
        try:
            provider = Provider.objects.get(id=provider_id)
        except ObjectDoesNotExist:
            messages.warning(request, "Provider '{}' does not exist.".format(provider_id))
            return redirect("providers")
    providers = Provider.objects.order_by("id")
    complete_usage = Provider.complete_user_usage()
    return render(request, 'appliances/providers.html', locals())
开发者ID:amavinag,项目名称:cfme_tests,代码行数:20,代码来源:views.py

示例2: provider_usage

# 需要导入模块: from appliances.models import Provider [as 别名]
# 或者: from appliances.models.Provider import complete_user_usage [as 别名]
def provider_usage(request):
    complete_usage = Provider.complete_user_usage(request.user)
    return render(request, 'appliances/provider_usage.html', locals())
开发者ID:rananda,项目名称:cfme_tests,代码行数:5,代码来源:views.py

示例3: providers

# 需要导入模块: from appliances.models import Provider [as 别名]
# 或者: from appliances.models.Provider import complete_user_usage [as 别名]
def providers(request):
    providers = Provider.objects.order_by("id")
    complete_usage = Provider.complete_user_usage()
    return render(request, 'appliances/providers.html', locals())
开发者ID:jaryn,项目名称:cfme_tests,代码行数:6,代码来源:views.py

示例4: provider_usage

# 需要导入模块: from appliances.models import Provider [as 别名]
# 或者: from appliances.models.Provider import complete_user_usage [as 别名]
def provider_usage(request):
    complete_usage = Provider.complete_user_usage(request.user)
    total_usage = sum(count for pair in complete_usage for count in [int(pair[1])])
    return render(request, 'appliances/provider_usage.html', locals())
开发者ID:apagac,项目名称:cfme_tests,代码行数:6,代码来源:views.py


注:本文中的appliances.models.Provider.complete_user_usage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。