From 7400179a34e9734335e572a93f17d0ebd17a72fb Mon Sep 17 00:00:00 2001 From: ChouUn Date: Fri, 20 Oct 2017 15:27:00 +0800 Subject: [PATCH] Update tutorial-plain.rst --- docs/tutorial-plain.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/tutorial-plain.rst b/docs/tutorial-plain.rst index 592f244..59575e6 100644 --- a/docs/tutorial-plain.rst +++ b/docs/tutorial-plain.rst @@ -80,7 +80,7 @@ Add ingredients as INSTALLED_APPS: INSTALLED_APPS = [ ... # Install the ingredients app - 'ingredients', + 'cookbook.ingredients', ] Don't forget to create & run migrations: @@ -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)