querying with timedelta fields seems not to work (on sqlite)
Filtering for this field in combination with Datetime seems not to work, at least using sqlite.
my model looks as follows:
class Event(models.Model): start_date = models.DateTimeField() duration = TimedeltaField(null=True, blank=True)
I want to make a query for all events that are starting in the future, or are still running, like so:
now = datetime.datetime.now() # 2013-06-04 events = Event.objects.exclude(start_date__lt=now-F('duration')) for x in events: print x.start_date, x.duration
2013-04-12 22:00:00 2 days, 0:00:00 2013-03-15 22:00:00 4:00:00 2013-12-28 20:00:00 1 day, 0:00:00 2013-06-03 06:00:00 2 days, 0:00:00