diff --git a/core/filters.py b/core/filters.py index ac71ee02..5fd261fa 100644 --- a/core/filters.py +++ b/core/filters.py @@ -276,8 +276,8 @@ class ProductFilter(FilterSet): ordering_param = self.data.get("order_by", "") - stock_with_price = Stock.objects.filter(product_uuid=OuterRef("pk"), price__gt=0) - stock_with_qty = Stock.objects.filter(product_uuid=OuterRef("pk"), quantity__gt=0) + stock_with_price = Stock.objects.filter(product_id=OuterRef("pk"), price__gt=0) + stock_with_qty = Stock.objects.filter(product_id=OuterRef("pk"), quantity__gt=0) qs = qs.annotate( has_price=Exists(stock_with_price), diff --git a/core/graphene/schema.py b/core/graphene/schema.py index a1dbe3ea..dcb1730f 100644 --- a/core/graphene/schema.py +++ b/core/graphene/schema.py @@ -163,8 +163,8 @@ class Query(ObjectType): .prefetch_related("images", "stocks") ) - stock_with_price = Stock.objects.filter(product_uuid=OuterRef("pk"), price__gt=0) - stock_with_qty = Stock.objects.filter(product_uuid=OuterRef("pk"), quantity__gt=0) + stock_with_price = Stock.objects.filter(product_id=OuterRef("pk"), price__gt=0) + stock_with_qty = Stock.objects.filter(product_id=OuterRef("pk"), quantity__gt=0) return ( base_qs.annotate(