Example #1
0
def get_bookings_for_avail_cal(lYear, lMonth, shoulder_days, num_days_in_month,
                               first_day):
    # https://stackoverflow.com/questions/36155332/how-to-get-the-first-day-and-last-day-of-current-month-in-python
    last_day = dateutil.parser.parse(
        str(lYear) + '-' + str(lMonth) + '-' + str(num_days_in_month))
    # 6 days either side so we can do the shoulder days
    from_date = first_day - timedelta(days=shoulder_days)
    to_date = last_day + timedelta(days=shoulder_days)
    my_bookings = Booking.get_bookings_in_range(from_date, to_date, True)
    return my_bookings