diff --git a/pinaxcon/templates/registrasion/discount_list.html b/pinaxcon/templates/registrasion/discount_list.html index 521794c8..b2836f52 100644 --- a/pinaxcon/templates/registrasion/discount_list.html +++ b/pinaxcon/templates/registrasion/discount_list.html @@ -1,6 +1,6 @@ {% if discounts %}
The following discounts and complimentary items are available to you. If you wish to take advantage of this offer, you must choose your items below. The discounts will be applied automatically when you check out.
{% regroup discounts by discount.description as discounts_grouped %} {% for discount_type in discounts_grouped %} diff --git a/vendor/registrasion/registrasion/views.py b/vendor/registrasion/registrasion/views.py index a6c7a2c4..fddbc0c8 100644 --- a/vendor/registrasion/registrasion/views.py +++ b/vendor/registrasion/registrasion/views.py @@ -1,3 +1,4 @@ +from collections import defaultdict import datetime import zipfile import os @@ -291,21 +292,22 @@ def _guided_registration_products(request, mode): seen_categories = [] with BatchController.batch(request.user): - available_products = list(ProductController.available_products( + available_products = ProductController.available_products( request.user, products=all_products, - )) + ) if len(available_products) == 0: return [] + available_by_category = defaultdict(list) + for product in available_products: + available_by_category[product.category].append(product) + has_errors = False for category in cats: - products = [ - i for i in available_products - if i.category == category - ] + products = available_by_category[category] prefix = "category_" + str(category.id) p = _handle_products(request, category, products, prefix)