From 435823f047114cd0750ccd2ccd3fed969efd49f5 Mon Sep 17 00:00:00 2001 From: Billy Jacoby Date: Sat, 7 Oct 2017 07:54:36 -0400 Subject: [PATCH] updated methods to take necessary parameters When running through the tutorial these were the changes i had to make in order to get the tutorial to work. --- docs/tutorial-plain.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/tutorial-plain.rst b/docs/tutorial-plain.rst index 6aa4294..e113296 100644 --- a/docs/tutorial-plain.rst +++ b/docs/tutorial-plain.rst @@ -157,10 +157,10 @@ Create ``cookbook/ingredients/schema.py`` and type the following: all_categories = graphene.List(CategoryType) all_ingredients = graphene.List(IngredientType) - def resolve_all_categories(self, info, **kwargs): + def resolve_all_categories(self, args, context, info): return Category.objects.all() - def resolve_all_ingredients(self, info, **kwargs): + def resolve_all_ingredients(self, args, context, info): # We can easily optimize query count in the resolve method return Ingredient.objects.select_related('category').all() @@ -438,15 +438,15 @@ We can update our schema to support that, by adding new query for ``ingredient`` name=graphene.String()) all_ingredients = graphene.List(IngredientType) - def resolve_all_categories(self, info, **kwargs): + def resolve_all_categories(self, args, context, info): return Category.objects.all() - def resolve_all_ingredients(self, info, **kwargs): + def resolve_all_ingredients(self, args, context, info): return Ingredient.objects.all() - def resolve_category(self, info, **kwargs): - id = kargs.get('id') - name = kargs.get('name') + def resolve_category(self, args, context, info): + id = args.get('id') + name = args.get('name') if id is not None: return Category.objects.get(pk=id) @@ -456,9 +456,9 @@ We can update our schema to support that, by adding new query for ``ingredient`` return None - def resolve_ingredient(self, info, **kwargs): - id = kargs.get('id') - name = kargs.get('name') + def resolve_ingredient(self, args, context, info): + id = args.get('id') + name = args.get('name') if id is not None: return Ingredient.objects.get(pk=id)