From 99b74c9262e380c3308e1ec871e2061b8aa1e1a4 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 29 Apr 2023 22:48:10 +0200 Subject: [PATCH] Fix article count on basket list --- src/purchase/templates/purchase/basket_list.html | 2 +- src/purchase/views/basket.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/purchase/templates/purchase/basket_list.html b/src/purchase/templates/purchase/basket_list.html index ffe053e..61d196d 100644 --- a/src/purchase/templates/purchase/basket_list.html +++ b/src/purchase/templates/purchase/basket_list.html @@ -10,7 +10,7 @@
{% blocktranslate with basket_id=basket.id %}Basket #{{ basket_id }}{% endblocktranslate %}

- {% blocktranslate count counter=basket.items.count %}1 item{% plural %}{{ counter }} items{% endblocktranslate %}
+ {% blocktranslate count counter=basket.articles_count %}1 item{% plural %}{{ counter }} items{% endblocktranslate %}
{{ basket.price|currency }}
{{ basket.payment_method|default:"-" }}
{% now "Y-m-d" as todays_date %} diff --git a/src/purchase/views/basket.py b/src/purchase/views/basket.py index f03b45c..0cd04cc 100644 --- a/src/purchase/views/basket.py +++ b/src/purchase/views/basket.py @@ -101,7 +101,7 @@ def additional_unpriced_product(request: WSGIRequest) -> HttpResponse: @permission_required("purchase.view_basket") @condition(etag_func=reports_etag, last_modified_func=reports_last_modified) def list_baskets(request: WSGIRequest) -> HttpResponse: - context = {"baskets": Basket.objects.priced().order_by("-id")} + context = {"baskets": Basket.objects.with_articles_count().priced().order_by("-id")} return render(request, "purchase/basket_list.html", context)