I'm trying to build an ecom website using django and djngo rest framework. My model Item contains price and sale_price column:
class Item(models.Model):
price = models.FloatField()
sale_price = models.FloatField(null=True,blank=True)
I want to filter them by max active price So in order to do that in sqlite i would write something like
SELECT * FROM item WHERE coalesce(sale_price,price) < maxPrice;
How can i do this in Django?