From c0b0ae780d0730bb16fec8aa1a9038856cd17248 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Mon, 25 Apr 2016 13:20:48 +1000 Subject: [PATCH] Removes confusingness from cart.py --- registrasion/controllers/cart.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/registrasion/controllers/cart.py b/registrasion/controllers/cart.py index a43115de..0a10e5f8 100644 --- a/registrasion/controllers/cart.py +++ b/registrasion/controllers/cart.py @@ -311,7 +311,7 @@ class CartController(object): commerce.DiscountItem.objects.filter(cart=self.cart).delete() product_items = self.cart.productitem_set.all().select_related( - "product", "product__category", + "product", "product__category", "product__price" ) products = [i.product for i in product_items] @@ -319,9 +319,6 @@ class CartController(object): # The highest-value discounts will apply to the highest-value # products first. - product_items = self.cart.productitem_set.all() - product_items = product_items.select_related("product") - product_items = product_items.order_by('product__price') product_items = reversed(product_items) for item in product_items: self._add_discount(item.product, item.quantity, discounts)