mezzanine_events/views.py
def event_list(request):
    """
    List view of all events.
    The filter form determines the start and end date interval.
    """
    start = None
    end = None
    form = ListFilterForm(request.GET)
    occurrences = Occurrence.objects.published().select_related("event")

    if form.is_valid():
        occurrences = form.filter(occurrences)
        start = form.cleaned_data["start_day"]
        end = form.cleaned_data["end_day"]

    # Adjust to include the current time if start is set to today
    if start == today():
        start = now()

    featured_occurrences = paginate(
        list(occurrences.filter(event__featured=True).all_occurrences(start, end)),
        page_num=request.GET.get("featured-page", 1),
        per_page=settings.EVENTS_FEATURED_PER_PAGE,
        max_paging_links=settings.MAX_PAGING_LINKS,
    )
    regular_occurrences = paginate(
        list(occurrences.filter(event__featured=False).all_occurrences(start, end)),
        page_num=request.GET.get("page", 1),
        per_page=settings.EVENTS_PER_PAGE,
        max_paging_links=settings.MAX_PAGING_LINKS,
    )

    context = {
        "today": today(),
        "start_day": start,
        "end_day": end,
        "filter_form": form,
        "filter_form_url": request.path,
        "featured_occurrences": featured_occurrences,
        "occurrences": regular_occurrences,
    }
    return render(request, "mezzanine_events/event_list.html", context)

    List view of all events.
    The filter form determines the start and end date interval.
    
List view of all events.
The filter form determines the start and end date interval.
List view of all events . The filter form determines the start and end date interval .
def event_list(request):
    start = None
    end = None
    form = ListFilterForm(request.GET)
    occurrences = Occurrence.objects.published().select_related("event")
    if form.is_valid():
        occurrences = form.filter(occurrences)
        start = form.cleaned_data["start_day"]
        end = form.cleaned_data["end_day"]
    if start == today():
        start = now()
    featured_occurrences = paginate(
        list(occurrences.filter(event__featured=True).all_occurrences(start, end)),
        page_num=request.GET.get("featured-page", 1),
        per_page=settings.EVENTS_FEATURED_PER_PAGE,
        max_paging_links=settings.MAX_PAGING_LINKS,
    )
    regular_occurrences = paginate(
        list(occurrences.filter(event__featured=False).all_occurrences(start, end)),
        page_num=request.GET.get("page", 1),
        per_page=settings.EVENTS_PER_PAGE,
        max_paging_links=settings.MAX_PAGING_LINKS,
    )
    context = {
        "today": today(),
        "start_day": start,
        "end_day": end,
        "filter_form": form,
        "filter_form_url": request.path,
        "featured_occurrences": featured_occurrences,
        "occurrences": regular_occurrences,
    }
    return render(request, "mezzanine_events/event_list.html", context)
def event_list ( request ) : start = None end = None form = ListFilterForm ( request . GET ) occurrences = Occurrence . objects . published ( ) . select_related ( "event" ) if form . is_valid ( ) : occurrences = form . filter ( occurrences ) start = form . cleaned_data [ "start_day" ] end = form . cleaned_data [ "end_day" ] if start == today ( ) : start = now ( ) featured_occurrences = paginate ( list ( occurrences . filter ( event__featured = True ) . all_occurrences ( start , end ) ) , page_num = request . GET . get ( "featured-page" , 1 ) , per_page = settings . EVENTS_FEATURED_PER_PAGE , max_paging_links = settings . MAX_PAGING_LINKS , ) regular_occurrences = paginate ( list ( occurrences . filter ( event__featured = False ) . all_occurrences ( start , end ) ) , page_num = request . GET . get ( "page" , 1 ) , per_page = settings . EVENTS_PER_PAGE , max_paging_links = settings . MAX_PAGING_LINKS , ) context = { "today" : today ( ) , "start_day" : start , "end_day" : end , "filter_form" : form , "filter_form_url" : request . path , "featured_occurrences" : featured_occurrences , "occurrences" : regular_occurrences , } return render ( request , "mezzanine_events/event_list.html" , context )
List view of all events.
List view of all events .
"""
    List view of all events.
    The filter form determines the start and end date interval.
    """ # Adjust to include the current time if start is set to today
request