4👍
✅
Close…inside your mutate
method you need to save your ingredient as an instance of Ingredient
(not IngredientType
) and then use that to create your IngredientType
object. Also, you should declare mutate
as @staticmethod
. Something like:
@staticmethod
def mutate(root, info, name):
ingredient = Ingredient.objects.create(name=name)
ok = True
return CreateIngredient(ingredient=ingredient, ok=ok)
Source:stackexchange.com