本文整理汇总了Python中products.models.Product.listing方法的典型用法代码示例。如果您正苦于以下问题:Python Product.listing方法的具体用法?Python Product.listing怎么用?Python Product.listing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类products.models.Product
的用法示例。
在下文中一共展示了Product.listing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: profile
# 需要导入模块: from products.models import Product [as 别名]
# 或者: from products.models.Product import listing [as 别名]
def profile(request, username):
current_user_profile_url = get_current_user_profile_url(request)
profile_user = User.objects.get(username=username)
if not profile_user:
raise Http404
can_review = request.user.can_review(profile_user)
products = Product.listing().filter(user=profile_user)
products_sold_count = Product.objects.filter(user=profile_user, purchase__isnull=False).count()
return render_to_response("profiles/profile.html", locals(), context_instance=RequestContext(request))
示例2: index
# 需要导入模块: from products.models import Product [as 别名]
# 或者: from products.models.Product import listing [as 别名]
def index(request):
# newest 6 created listings can go here OR we can have featured products
products = Product.listing().filter(featured=True)[:6]
return render_to_response("pages/index.html", locals(), context_instance=RequestContext(request))