Example #1
0
def core_organization_view(request, organization):
    t = now()

    past_events = Event.objects.filter(organization=organization,
                                       public=True,
                                       end_time__lte=t).order_by('-start_time')
    current_events = Event.objects.filter(
        organization=organization,
        public=True,
        start_time__lte=t,
        end_time__gt=t).order_by('-start_time')
    future_events = Event.objects.filter(
        Q(organization=organization, public=True)
        & (Q(start_time__gt=t)
           | Q(start_time__isnull=True))).order_by('start_time')

    vars = dict(
        organization=organization,
        past_events_rows=list(groups_of_n(past_events, 4)),
        current_events_rows=list(groups_of_n(current_events, 4)),
        future_events_rows=list(groups_of_n(future_events, 4)),
    )

    if 'membership' in settings.INSTALLED_APPS:
        from membership.views import membership_organization_box_context
        vars.update(membership_organization_box_context(request, organization))

    return render(request, 'core_organization_view.jade', vars)
Example #2
0
def core_organization_view(request, organization):
    t = now()

    past_events = Event.objects.filter(organization=organization, public=True, end_time__lte=t).order_by('-start_time')
    current_events = Event.objects.filter(organization=organization, public=True, start_time__lte=t, end_time__gt=t).order_by('-start_time')
    future_events = Event.objects.filter(Q(organization=organization, public=True) & (Q(start_time__gt=t) | Q(start_time__isnull=True))).order_by('start_time')

    vars = dict(
        organization=organization,
        past_events_rows=list(groups_of_n(past_events, 4)),
        current_events_rows=list(groups_of_n(current_events, 4)),
        future_events_rows=list(groups_of_n(future_events, 4)),
    )

    if 'membership' in settings.INSTALLED_APPS:
        from membership.views import membership_organization_box_context
        vars.update(membership_organization_box_context(request, organization))

    return render(request, 'core_organization_view.jade', vars)