I am trying to query the postgres database from django, I am running cron using custom control commands. I have a time-stamped model Bookingthat was created and modified by parameters, so I know if the cron job has already been called for this particular reservation. Now the cron job is called every hour, so I need to request my booking model as
s = Booking.objects.all().filter(created_at = datetime.now())
Is there a way to specify the time range for created_at, and not a specific value, I want my range to be the current time - from 1 hour to the current time.
I know that I can get all the objects and check them all separately, I just wanted to know if there is a way to include this in a Django request.
source
share