mirror of
https://github.com/graphql-python/graphene-django.git
synced 2024-11-29 04:53:43 +03:00
Merge pull request #45 from drzix/master
Remove an unneeded backup file
This commit is contained in:
commit
d52471859d
|
@ -1,33 +0,0 @@
|
||||||
from cookbook.ingredients.models import Recipe, Ingredient
|
|
||||||
from graphene import AbstractType, Node
|
|
||||||
from graphene_django.filter import DjangoFilterConnectionField
|
|
||||||
from graphene_django.types import DjangoObjectType
|
|
||||||
|
|
||||||
class RecipeNode(DjangoObjectType):
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = Recipe
|
|
||||||
interfaces = (Node, )
|
|
||||||
filter_fields = ['name', 'ingredients']
|
|
||||||
filter_order_by = ['name']
|
|
||||||
|
|
||||||
class RecipeIngredientNode(DjangoObjectType):
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = RecipeIngredient
|
|
||||||
# Allow for some more advanced filtering here
|
|
||||||
interfaces = (Node, )
|
|
||||||
filter_fields = {
|
|
||||||
'name': ['exact', 'icontains', 'istartswith'],
|
|
||||||
'notes': ['exact', 'icontains'],
|
|
||||||
'recipe': ['exact'],
|
|
||||||
'recipe__name': ['icontains'],
|
|
||||||
}
|
|
||||||
filter_order_by = ['name', 'recipe__name',]
|
|
||||||
|
|
||||||
class Query(AbstractType):
|
|
||||||
recipe = Node.Field(RecipeNode)
|
|
||||||
all_categories = DjangoFilterConnectionField(RecipeNode)
|
|
||||||
|
|
||||||
recipeingredient = Node.Field(IngredientNode)
|
|
||||||
all_recipeingredients = DjangoFilterConnectionField(RecipeIngredientNode)
|
|
Loading…
Reference in New Issue
Block a user