From 8b796706089af952d47a871da4f2a581184ccce7 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Thu, 31 Mar 2016 19:13:31 +1100 Subject: [PATCH] Fixes issue #8 --- registrasion/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/registrasion/views.py b/registrasion/views.py index d1c4d722..b0f7093e 100644 --- a/registrasion/views.py +++ b/registrasion/views.py @@ -188,7 +188,10 @@ def handle_products(request, category, products, prefix): @transaction.atomic def set_quantities_from_products_form(products_form, current_cart): - for product_id, quantity, field_name in products_form.product_quantities(): + # TODO: issue #8 is a problem here. + quantities = list(products_form.product_quantities()) + quantities.sort(key=lambda item: item[1]) + for product_id, quantity, field_name in quantities: product = rego.Product.objects.get(pk=product_id) try: current_cart.set_quantity(product, quantity, batched=True)