From ff1afb714f1e7b4d9a353061f3454af1f180c706 Mon Sep 17 00:00:00 2001 From: Diego Calvo Date: Fri, 19 Mar 2021 08:14:36 +0100 Subject: [PATCH] min and max prices values instead of dict --- products/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/views.py b/products/views.py index 33e5266..0037ab3 100644 --- a/products/views.py +++ b/products/views.py @@ -218,8 +218,8 @@ def product_search(request): products_qs = products_qs.filter(price__lte=price_max) # get min_price and max_price - prices['min'] = products_qs.aggregate(Min('price')) - prices['max'] = products_qs.aggregate(Max('price')) + prices['min'] = products_qs.aggregate(Min('price'))['price__min'] + prices['max'] = products_qs.aggregate(Max('price'))['price__max'] # serialize and list data serializer = ProductSerializer(products_qs, many=True) result_list = [dict(i) for i in serializer.data]