Esempio n. 1
0
def events(request):
    outs = get_globals(request)
    now = datetime.now(TZ)
    try:
        events = Event.group(Event.get_day(now, now + timedelta(4*7)))
    except IOError:
        events = {}
    for area in ['social', 'food', 'prof_dinners', 'sophs', 'im', 'service']:
        outs[area] = {}
        outs[area]['officers'] = officer_get_area(area)
        try:
            outs[area]['events'] = events[area]
        except KeyError:
            outs[area]['events'] = []
        outs[area]['statement'] = textblock_get(description=area)
    return render(request, 'events.html', outs)
def events(request):
    check_parameters(request, ['start', 'end'])
    # We take days as arguments
    start = parser.parse(request.GET['start'])
    end = parser.parse(request.GET['end'])
    try:
        events = Event.group(Event.get_day(start, end))
    except IOError:
        events = {}
    
    events = to_dict(events)
    for cal in events:
        for event in events[cal]:
            event['day_long'] = event['dayLong']
            del(event['dayLong'])
    return {'events': events}