예제 #1
0
def meals(request):
    check_parameters(request, ['day'])
    t = datetime.strptime(request.GET['day'], "%Y-%m-%d")
    day  = date(t.year, t.month, t.day)
    meals = list(Meal.objects.filter(day=day))
    meals.sort()
    return {'meals': meals}
예제 #2
0
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.get_day(start, end)
    except IOError:
        events = []
    return {'events': events}
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}