From 4dc150d7348f84d8fb05eabd44f9bff886dc1d1a Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Wed, 23 Mar 2016 14:50:52 +1100 Subject: [PATCH] Fills in quantity boxes from the quantities in the current cart, not overall --- registrasion/views.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/registrasion/views.py b/registrasion/views.py index 0c6c5ee6..075cd2e7 100644 --- a/registrasion/views.py +++ b/registrasion/views.py @@ -21,6 +21,7 @@ def product_category(request, category_id): category_id = int(category_id) # Routing is [0-9]+ category = rego.Category.objects.get(pk=category_id) + current_cart = CartController.for_user(request.user) CategoryForm = forms.CategoryForm(category) @@ -30,7 +31,6 @@ def product_category(request, category_id): if request.method == "POST": cat_form = CategoryForm(request.POST, request.FILES, prefix=PRODUCTS_FORM_PREFIX) voucher_form = forms.VoucherForm(request.POST, prefix=VOUCHERS_FORM_PREFIX) - current_cart = CartController.for_user(request.user) if voucher_form.is_valid(): # Apply voucher @@ -59,7 +59,10 @@ def product_category(request, category_id): else: # Create initial data for each of products in category - items = rego.ProductItem.objects.filter(product__category=category) + items = rego.ProductItem.objects.filter( + product__category=category, + cart=current_cart.cart, + ) quantities = [] for product in products: # Only add items that are enabled.