本文整理汇总了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())
示例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())
示例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())
示例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())