| 1 | import graphenescip-python python graphene 3.4.3 graphene/__init__: |
| 2 | from graphene_django.typesscip-python python graphene-django 3.2.3 `graphene_django.types`/__init__: import DjangoObjectTypescip-python python graphene-django 3.2.3 `graphene_django.types`/DjangoObjectType# |
| 3 | |
| 4 | from .modelsscip-python python graphene-django 3.2.3 models/__init__: import Categoryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Category#, Ingredientscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Ingredient# |
| 5 | |
| 6 | |
| 7 | class CategoryTypescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/CategoryType#(DjangoObjectTypescip-python python graphene-django 3.2.3 `graphene_django.types`/DjangoObjectType#): |
| 8 | class Metascip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/CategoryType#Meta#: |
| 9 | modelscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/CategoryType#Meta#model. = Categoryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Category# |
| 10 | fieldsscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/CategoryType#Meta#fields. = "__all__" |
| 11 | |
| 12 | |
| 13 | class IngredientTypescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/IngredientType#(DjangoObjectTypescip-python python graphene-django 3.2.3 `graphene_django.types`/DjangoObjectType#): |
| 14 | class Metascip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/IngredientType#Meta#: |
| 15 | modelscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/IngredientType#Meta#model. = Ingredientscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Ingredient# |
| 16 | fieldsscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/IngredientType#Meta#fields. = "__all__" |
| 17 | |
| 18 | |
| 19 | class Queryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#: |
| 20 | categoryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#category. = graphenescip-python python graphene 3.4.3 graphene/__init__:.Fieldscip-python python graphene-django 3.2.3 `graphene.types.field`/Field#(CategoryTypescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/CategoryType#, id=graphenescip-python python graphene 3.4.3 graphene/__init__:.Intscip-python python graphene-django 3.2.3 `graphene.types.scalars`/Int#(), name=graphenescip-python python graphene 3.4.3 graphene/__init__:.Stringscip-python python graphene-django 3.2.3 `graphene.types.scalars`/String#()) |
| 21 | all_categoriesscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#all_categories. = graphenescip-python python graphene 3.4.3 graphene/__init__:.Listscip-python python graphene-django 3.2.3 `graphene.types.structures`/List#(CategoryTypescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/CategoryType#) |
| 22 | |
| 23 | ingredientscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#ingredient. = graphenescip-python python graphene 3.4.3 graphene/__init__:.Fieldscip-python python graphene-django 3.2.3 `graphene.types.field`/Field#( |
| 24 | IngredientTypescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/IngredientType#, id=graphenescip-python python graphene 3.4.3 graphene/__init__:.Intscip-python python graphene-django 3.2.3 `graphene.types.scalars`/Int#(), name=graphenescip-python python graphene 3.4.3 graphene/__init__:.Stringscip-python python graphene-django 3.2.3 `graphene.types.scalars`/String#() |
| 25 | ) |
| 26 | all_ingredientsscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#all_ingredients. = graphenescip-python python graphene 3.4.3 graphene/__init__:.Listscip-python python graphene-django 3.2.3 `graphene.types.structures`/List#(IngredientTypescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/IngredientType#) |
| 27 | |
| 28 | def resolve_all_categoriesscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_all_categories().(selfscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_all_categories().(self), contextscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_all_categories().(context)): |
| 29 | return Categoryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Category#.objects.all() |
| 30 | |
| 31 | def resolve_all_ingredientsscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_all_ingredients().(selfscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_all_ingredients().(self), contextscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_all_ingredients().(context)): |
| 32 | # We can easily optimize query count in the resolve method |
| 33 | return Ingredientscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Ingredient#.objects.select_related("category").all() |
| 34 | |
| 35 | def resolve_categoryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(selfscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(self), contextscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(context), idscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(id)=None, namescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(name)=None): |
| 36 | if idscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(id) is not None: |
| 37 | return Categoryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Category#.objects.get(pk=idscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(id)) |
| 38 | |
| 39 | if namescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(name) is not None: |
| 40 | return Categoryscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Category#.objects.get(name=namescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_category().(name)) |
| 41 | |
| 42 | return None |
| 43 | |
| 44 | def resolve_ingredientscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(selfscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(self), contextscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(context), idscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(id)=None, namescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(name)=None): |
| 45 | if idscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(id) is not None: |
| 46 | return Ingredientscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Ingredient#.objects.get(pk=idscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(id)) |
| 47 | |
| 48 | if namescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(name) is not None: |
| 49 | return Ingredientscip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.models`/Ingredient#.objects.get(name=namescip-python python graphene-django 3.2.3 `examples.cookbook-plain.cookbook.ingredients.schema`/Query#resolve_ingredient().(name)) |
| 50 | |
| 51 | return None |