Example #1
0
def event_on_date(event, date):

    for d in iter_date_range(event.start, event.end):
        if d == date.as_date:
            return True

    return False
Example #2
0
def calculate_remaining_space(event, date, width):
    """
    Returns the remaining space for the event title for the row which contains date
    """
    start = first_day_of_week(date)
    end = last_day_of_week(date)

    if event.start.as_date == end.as_date:
        return width

    if event.start.as_date > start.as_date:
        start = event.start
    else:
        width -= 2*PADDING_START
    if event.end.as_date < end:
        end = event.end
    else:
        width -= PADDING_END

    width -= PADDING_TITLE_LEFT

    remaining_space = 0
    for date in iter_date_range(start, end):
        remaining_space += width
    return remaining_space
Example #3
0
 def get_date_range(event):
     for date in iter_date_range(event.start, event.end):
        if date.year == self.date.year and date.month == self.date.month:
             yield date