Ejemplo n.º 1
0
 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}
Ejemplo n.º 2
0
 def get(self):
     foods = [food.json() for food in FoodModel.find_all()]
     return {'food': foods}, 200