예제 #1
0
def category_processor(request, page):
    """
    Add paging/sorting to the products for the category.
    """
    settings.use_editable()
    per_page = settings.SHOP_PER_PAGE_CATEGORY
    products = page.category.products.all()
    return {"products": product_list(products, request, per_page)}
예제 #2
0
def category_processor(request, page):
    """
    Add paging/sorting to the products for the category.
    """
    settings.use_editable()
    per_page = settings.SHOP_PER_PAGE_CATEGORY
    published_products = Product.objects.published(for_user=request.user)
    filters = page.category.filters()
    products = published_products.filter(filters).distinct()
    return {"products": product_list(products, request, per_page)}