diff --git a/src/purchase/templates/purchase/snippets/basket_unpriced_item.html b/src/purchase/templates/purchase/snippets/basket_unpriced_item.html index 4cfaeeb..69e061d 100644 --- a/src/purchase/templates/purchase/snippets/basket_unpriced_item.html +++ b/src/purchase/templates/purchase/snippets/basket_unpriced_item.html @@ -14,7 +14,7 @@

{{ product.name }}

-
diff --git a/src/purchase/views/basket.py b/src/purchase/views/basket.py index f9d7a97..5e22bb1 100644 --- a/src/purchase/views/basket.py +++ b/src/purchase/views/basket.py @@ -49,8 +49,13 @@ def update_with_unpriced_products(basket: Basket, post_data: MultiValueDict): basket.items.filter(product__in=no_fixed_price.values()).delete() for product_id, product in no_fixed_price.items(): if prices := post_data.getlist(f"{UNPRICED_PREFIX}{product_id}"): - for price in prices: - basket.items.create(product=product, quantity=1, unit_price_cents=price) + for price in map(int, prices): + if price: + basket.items.create( + product=product, + quantity=1, + unit_price_cents=price, + ) @require_http_methods(["GET", "POST"])