happenings/utils/displays.py
def day_display(year, month, all_month_events, day):
    """
    Returns the events that occur on the given day.
    Works by getting all occurrences for the month, then drilling
    down to only those occurring on the given day.
    """
    # Get a dict with all of the events for the month
    count = CountHandler(year, month, all_month_events).get_count()
    pks = [x[1] for x in count[day]]  # list of pks for events on given day
    # List enables sorting.
    # See the comments in EventMonthView in views.py for more info
    day_events = list(Event.objects.filter(pk__in=pks).order_by(
        'start_date').prefetch_related('cancellations'))
    day_events.sort(key=lambda x: x.l_start_date.hour)
    return day_events
def day_display(year, month, all_month_events, day):
    """
    Returns the events that occur on the given day.
    Works by getting all occurrences for the month, then drilling
    down to only those occurring on the given day.
    """
    # Get a dict with all of the events for the month
    count = CountHandler(year, month, all_month_events).get_count()
    pks = [x[1] for x in count[day]]  # list of pks for events on given day
    # List enables sorting.
    # See the comments in EventMonthView in views.py for more info
    day_events = list(Event.objects.filter(pk__in=pks).order_by(
        'start_date').prefetch_related('cancellations'))
    day_events.sort(key=lambda x: x.l_start_date.hour)
    return day_events
Returns the events that occur on the given day.
    Works by getting all occurrences for the month, then drilling
    down to only those occurring on the given day.