Пример #1
0
def now(request):
    drinks = get_current(Drink)
    announcements = get_current(Announcement)
    meals = []
    now = datetime.now().time()
    for meal in list(Meal.objects.filter(day=date.today())):
        if meal.type.start < now and meal.type.end > now:
            meals.append(meal)
    try:
        events = Event.get(datetime.now(), datetime.now() + timedelta(minutes=15))
    except IOError:
        events = []
    return {'announcements': announcements,
            'drinks': drinks,
            'meals': meals,
            'events': events}
Пример #2
0
def drinks(request):
    return {'drinks': get_current(Drink)}
Пример #3
0
def announcements(request):
    return {'announcements': get_current(Announcement)}