min and max prices values instead of dict
This commit is contained in:
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user