[Answer]-Using Django Q objects in *__lte keywords

1👍

✅

Get rid of the wrapping Q() and you should have a working result. See https://docs.djangoproject.com/en/dev/topics/db/queries/#using-f-expressions-in-filters for examples.

ThatModel.objects.filter(desired_moisture__lte=(F("sensor__moisture") + F("sensor__calibrate_low")) / F("sensor__calibrate_high") + F("upper_deviation"))

Leave a comment