diff --git a/backend/product/views.py b/backend/product/views.py index af4f94a..ca9675e 100644 --- a/backend/product/views.py +++ b/backend/product/views.py @@ -172,8 +172,11 @@ class AllProductsView(APIView): products = products.filter(Q(name__icontains=search_query) | Q(description__icontains=search_query)) # Price filters - price_gte = request.query_params.get('price_gte', None) - price_lte = request.query_params.get('price_lte', None) + try: + price_gte = int(request.query_params.get('price_gte', None)) + price_lte = int(request.query_params.get('price_lte', None)) + except: + return Response({'detail': 'value error price_gte and price_lte should be a number'}, status=status.HTTP_400_BAD_REQUEST) if price_gte: products = products.filter(price__gte=price_gte) if price_lte: