I\'m struggling with a Django filtering problem I couldn\'t solve so far. I have a database with from/to integers, and I need a Django Filter that returns any objects where
Dataset.objects.filter(i_begin_int__lte=170, i_end_int__gte=170)
Filter where i_begin_int is less than 170 AND the i_end_int value is greater than 170.
SQL equivalent: SELECT * FROM appname_dataset WHERE i_begin_int <= 170 AND i_end_int >= 170
Try this;
x = 170
Dataset.objects.filter(i_end_int__gte=x,i_begin_int__lte=x)
where; gte = greater than equal to lte = less than equal to