def get(self): foods = [food.json() for food in FoodModel.find_all()] results = {} for food in foods: if food['category'] not in results: results[food['category']] = [] results[food['category']].append(food) return {'categories': results}
def get(self): foods = [food.json() for food in FoodModel.find_all()] return {'food': foods}, 200