fix: changed like button

This commit is contained in:
2025-01-02 13:35:05 +01:00
parent 5bc45eae0a
commit ab2c9f4d22
6 changed files with 44 additions and 54 deletions
+1 -11
View File
@@ -1,8 +1,4 @@
from decimal import Decimal
from django.db.models import Sum
from shop.models import Cart, CartItem
from shop.models import Cart
from web.settings import ANONYMOUS_CART_ID_COOKIE_NAME
@@ -20,9 +16,3 @@ def get_or_create_cart(request) -> [Cart, bool]:
cart, created = Cart.objects.get_or_create(user=request.user)
return cart, created
def get_cart_total(cart: Cart):
return CartItem.objects.filter(cart=cart).annotate(cart_total=Sum("total")).get(
"cart_total"
) or Decimal("0.00")