Django DateTimeRangeField how to filter by lower only?

737 Views Asked by At

Let's say I have a model with the DateTimeRangeField, and I would like to filter by the lower bound greater than now(), regardless whatupper bound is:

BackupResource.objects.filter(datetime_range__lower__gt=timezone.now())

It errors out:

Unsupported lookup 'lower' for DateTimeRangeField or join on the field not permitted.
1

There are 1 best solutions below

0
NS0 On BEST ANSWER

Try doing the following

BackupResource.objects.filter(datetime_range__startswith__gt=timezone.now())