[Answer]-Django Query writing

1👍

Assuming you have models that maps 1-1 with your SQL query:

status_zeros = Dispatch.objects.filter(status=0).values_list('pk', flat=True)
BookingTimeline.objects.filter(status="completed", pk__in=status_zeros)

0👍

And than should be

booking_timelines = BookingTimeline.objects.filter(status="completed",pk__in=status_zeros)
times_set = set( booking_timelines.values_list('time', flat=True) ) 
👤CoRy

Leave a comment