[Answered ]-Check if datetime object is present in database

2👍

You need to check if there are any bookings with a start time earlier or the same as your requested start and an end time later or the same as the requested start:

Booking.objects.filter(start_date__lte=start_time, end_date__gte=start_time).count()

If that comes back as 0 then the start time isn’t already booked.

Leave a comment