Commits

Anonymous committed e5b6356

Change the default category view to include all products of child categories.

Comments (0)

Files changed (1)

satchmo/apps/product/views/__init__.py

     """
     try:
         category =  Category.objects.get_by_site(slug=slug)
-        products = list(category.active_products())
-        sale = find_best_auto_discount(products)
-
     except Category.DoesNotExist:
         return bad_or_missing(request, _('The category you have requested does not exist.'))
 
+    products = category.active_products(include_children=True)
     child_categories = category.get_all_children()
 
     ctx = {
         'category': category,
         'child_categories': child_categories,
-        'sale' : sale,
         'products' : products,
     }
     index_prerender.send(Product, request=request, context=ctx, category=category, object_list=products)
+
+    # Evaluate the query set.
+    ctx['products'] = list(ctx['products'])
+    ctx['sale'] = find_best_auto_discount(ctx['products'])
+
     return render_to_response(template, context_instance=RequestContext(request, ctx))
 
-
 def display_featured(num_to_display=None, random_display=None):
     """
     Used by the index generic view to choose how the featured products are displayed.