I am trying to query my postgres database from django, I'm running a cron using custom management commands. I have a time stamped model called Booking
, which has created at and modified at parameters, so that I know if the cron job has already been called for that particular booking. Now the cron job is called every hour, So what I need to do is to query my Booking model as
s = Booking.objects.all().filter(created_at = datetime.now())
is there a way I can specify a time range for created_at rather than a specific value, I want my range to be current time - 1 hour to current time.
I know that I can retrieve all objects and test all of them individually, I just wanted to know if there's a way to incorporate this into the Django query.