I have a model in django having arrival_date, arrival_time and duration as columns. I require to filter the objects for which the arrival_date is today, and arrival_time + duration is not greater than current time.
q1 = Q(arrival_date=current_date)
q2 = Q(arrival_time__lte=current_time - timedelta(minutes='duration')
[this is where I need help. using 'duration' or F object doesn't help]
objs = Model.Objects.filter(q1 & q2)
I believe I'm on wrong track. There must be some standard way to accomplish this. Any help is appreciated.
Thanks,
Rakesh