3 ms·
Do this: def __gt__(self, value): return Q(**{ f"{self.name}__gt": value }) and your original code should work as-is without the need for _() self.
by Izkata 3mo ago
Do this:
def __gt__(self, value):
return Q(**{ f"{self.name}__gt": value })
and your original code should work as-is without the need for _()
self.filter(Field.end > self._midnight(today))
https://docs.djangoproject.com/en/6.0/topics/db/queries/#complex-lookups-with-q-objects https://docs.djangoproject.com/en/6.0/topics/db/queries/#com...