1👍
✅
You use an .alias(…)
[Django-doc] for the expression, and then .filter(…)
[Django-doc] on that alias:
queryset.alias(
my_price=Case(
When(price_after_static_discount=0, then=F('price')),
default=F('price_after_discount'),
)
).filter(my_price__lt=value)
Source:stackexchange.com