diff --git a/mealapi/schemas/ingredientschema.py b/mealapi/schemas/ingredientschema.py index f9a65f3..d048f83 100644 --- a/mealapi/schemas/ingredientschema.py +++ b/mealapi/schemas/ingredientschema.py @@ -3,7 +3,8 @@ from .marshm import ma from model import Ingredient -class IngredientSchema(ma.ModelSchema): +class IngredientSchema(ma.SQLAlchemyAutoSchema): class Meta: model = Ingredient + load_instance = True diff --git a/mealapi/schemas/mealschema.py b/mealapi/schemas/mealschema.py index 89640e7..34b10e5 100644 --- a/mealapi/schemas/mealschema.py +++ b/mealapi/schemas/mealschema.py @@ -4,10 +4,11 @@ from model import Meal from .ingredientschema import IngredientSchema -class MealSchema(ma.ModelSchema): +class MealSchema(ma.SQLAlchemyAutoSchema): # A list of author objects authors = ma.Nested(IngredientSchema, many=True) class Meta: model = Meal + load_instance = True