Price is not a relation and cannot select_related

This field is ignored in 1.9, however in 1.10+ it is an error.
As this is a no-op in 1.9, removal keeps functionality while
extending compatability going forward.

For full details please see Django Ticket 10414 at:
https://code.djangoproject.com/ticket/10414
This commit is contained in:
Sachi King 2017-04-05 21:07:59 +10:00
parent be0d04c9c4
commit 4456398735

View file

@ -445,7 +445,7 @@ class CartController(object):
# Order the products such that the most expensive ones are
# processed first.
product_items = self.cart.productitem_set.all().select_related(
"product", "product__category", "product__price"
"product", "product__category"
).order_by("-product__price")
products = [i.product for i in product_items]