def calorie_graph_data(request): session = Session() food_entries = session.query(FoodEntry).order_by(FoodEntry.date).all() food_days = FoodDay.group_days(food_entries) tags = session.query(FoodTag).order_by(FoodTag.id) session.close() return {'food_days': map(lambda x: x.to_dict(), food_days), 'tags': map(lambda x: x.to_dict(), tags)}
def food_entry_list(request): session = Session() food_entries = session.query(FoodEntry).order_by(FoodEntry.date) food_days = FoodDay.group_days(food_entries) session.close() return {'title': 'Food Entries', 'food_entries': food_entries, 'food_days': food_days}
def calorie_graph(request): session = Session() food_entries = session.query(FoodEntry).order_by(FoodEntry.date) food_days = FoodDay.group_days(food_entries) session.close() return {'title': 'Calorie Graph', 'food_entries': food_entries, 'food_days': food_days}