meal_homework/mealapi/schemas/mealschema.py

14 lines
286 B
Python
Raw Normal View History

2022-02-13 20:38:02 +01:00
#!/usr/bin/env python3
from .marshm import ma
2022-02-13 20:52:51 +01:00
from model import Meal
2022-02-13 20:38:02 +01:00
from .ingredientschema import IngredientSchema
2022-02-13 20:56:17 +01:00
class MealSchema(ma.SQLAlchemyAutoSchema):
2022-02-13 20:38:02 +01:00
2022-02-13 21:43:59 +01:00
ingredients = ma.Nested(IngredientSchema, many=True)
2022-02-13 20:38:02 +01:00
class Meta:
model = Meal
2022-02-13 20:56:17 +01:00
load_instance = True