Select IF(5>10, true, false);
I want to write this using Django model.
Select IF(5>10, true, false);
I want to write this using Django model.
 
    
     
    
    you can use case when. see example below:
YourModel.objects.annotate(
    discount=Case(
        When(field_value__lte=5, then=Value(1)),
        default=Value(0),
        output_field=IntegerField(),
    ),
)
you can write case when as you needed. see documentation in this link https://docs.djangoproject.com/en/2.1/ref/models/conditional-expressions/
