From 51bbea4361d4fafe93997ed0f3dae05be8389c96 Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Thu, 19 Sep 2024 19:52:02 +0100 Subject: wip: getting the thumbnails of resources --- pyblackbird_cc/payments/views.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'pyblackbird_cc/payments/views.py') diff --git a/pyblackbird_cc/payments/views.py b/pyblackbird_cc/payments/views.py index 36f1d84..28ad10d 100644 --- a/pyblackbird_cc/payments/views.py +++ b/pyblackbird_cc/payments/views.py @@ -17,9 +17,6 @@ from .models import ShoppingCart stripe.api_key = settings.STRIPE_SECRET_KEY -def cart(request): - cart = ShoppingCart.objects.get(user=request.user) - return render(request, "cart_detail.html", {"cart": cart}) class CreateCheckoutSessionView(View): @@ -69,12 +66,18 @@ def add_to_cart(request, resource_id): cart_item.save() return redirect("cart_detail") - @login_required def cart_detail(request): cart, created = ShoppingCart.objects.get_or_create(user=request.user) + # TODO Here we need to iterate over cart_items and extract metadata + # for each one so that we can access thumbnails in the template + #resource_metadata = _extract_metadata_from_resource(resource_obj) return render(request, "payments/cart_detail.html", {"cart": cart}) +# def cart_detail(request): +# cart, created = ShoppingCart.objects.get_or_create(user=request.user) +# return render(request, "payments/cart_detail.html", {"cart": cart}) + @login_required def checkout(request): -- cgit v1.2.3