From db737eca02ebd25fa39b2cb89a78b72a4a96ae3c Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 26 Feb 2018 21:55:38 +0100 Subject: [PATCH] only get the cart the cart was created in the cart view. In the checkout we only want to display it. --- django/didgeridoo/webshop/views.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/django/didgeridoo/webshop/views.py b/django/didgeridoo/webshop/views.py index b962d36..8f0a5d6 100644 --- a/django/didgeridoo/webshop/views.py +++ b/django/didgeridoo/webshop/views.py @@ -351,12 +351,10 @@ def checkout(request): # • cancelled -> Bestellung storniert # • on hold -> Bestellung pausiert - cart_id, created_cart = ShoppingCart.objects.get_or_create( - user=request.user) - if created_cart is False: + cart = ShoppingCart.objects.get(user=request.user) + if cart: # get all items in the cart of this customer: - cart_positions = CartPosition.objects.filter( - cart=cart_id) + cart_positions = CartPosition.objects.filter(cart=cart) if (cart_positions.count()) > 0: # make a list out of all articles: cart_position_list = list(cart_positions)