Fix article count on basket list

This commit is contained in:
Gabriel Augendre 2023-04-29 22:48:10 +02:00
parent 3eb55181eb
commit 99b74c9262
2 changed files with 2 additions and 2 deletions

View file

@ -10,7 +10,7 @@
<div class="card-body">
<h5 class="card-title">{% blocktranslate with basket_id=basket.id %}Basket #{{ basket_id }}{% endblocktranslate %}</h5>
<p class="card-text">
{% blocktranslate count counter=basket.items.count %}1 item{% plural %}{{ counter }} items{% endblocktranslate %}<br>
{% blocktranslate count counter=basket.articles_count %}1 item{% plural %}{{ counter }} items{% endblocktranslate %}<br>
{{ basket.price|currency }}<br>
{{ basket.payment_method|default:"-" }}<br>
{% now "Y-m-d" as todays_date %}

View file

@ -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)