Add explicit fields = "__all__" in examples as it will be required soon

This commit is contained in:
radoslaw.kowalski 2020-06-07 12:26:41 +02:00
parent 64c2371cf7
commit d478275bca
5 changed files with 11 additions and 0 deletions

View File

@ -7,11 +7,13 @@ from .models import Category, Ingredient
class CategoryType(DjangoObjectType): class CategoryType(DjangoObjectType):
class Meta: class Meta:
model = Category model = Category
fields = "__all__"
class IngredientType(DjangoObjectType): class IngredientType(DjangoObjectType):
class Meta: class Meta:
model = Ingredient model = Ingredient
fields = "__all__"
class Query(object): class Query(object):

View File

@ -7,11 +7,13 @@ from .models import Recipe, RecipeIngredient
class RecipeType(DjangoObjectType): class RecipeType(DjangoObjectType):
class Meta: class Meta:
model = Recipe model = Recipe
fields = "__all__"
class RecipeIngredientType(DjangoObjectType): class RecipeIngredientType(DjangoObjectType):
class Meta: class Meta:
model = RecipeIngredient model = RecipeIngredient
fields = "__all__"
class Query(object): class Query(object):

View File

@ -10,6 +10,7 @@ class CategoryNode(DjangoObjectType):
class Meta: class Meta:
model = Category model = Category
interfaces = (Node,) interfaces = (Node,)
fields = "__all__"
filter_fields = ["name", "ingredients"] filter_fields = ["name", "ingredients"]
@ -18,6 +19,7 @@ class IngredientNode(DjangoObjectType):
model = Ingredient model = Ingredient
# Allow for some more advanced filtering here # Allow for some more advanced filtering here
interfaces = (Node,) interfaces = (Node,)
fields = "__all__"
filter_fields = { filter_fields = {
"name": ["exact", "icontains", "istartswith"], "name": ["exact", "icontains", "istartswith"],
"notes": ["exact", "icontains"], "notes": ["exact", "icontains"],

View File

@ -8,6 +8,7 @@ class RecipeNode(DjangoObjectType):
class Meta: class Meta:
model = Recipe model = Recipe
interfaces = (Node,) interfaces = (Node,)
fields = "__all__"
filter_fields = ["title", "amounts"] filter_fields = ["title", "amounts"]
@ -16,6 +17,7 @@ class RecipeIngredientNode(DjangoObjectType):
model = RecipeIngredient model = RecipeIngredient
# Allow for some more advanced filtering here # Allow for some more advanced filtering here
interfaces = (Node,) interfaces = (Node,)
fields = "__all__"
filter_fields = { filter_fields = {
"ingredient__name": ["exact", "icontains", "istartswith"], "ingredient__name": ["exact", "icontains", "istartswith"],
"recipe": ["exact"], "recipe": ["exact"],

View File

@ -12,6 +12,7 @@ class Ship(DjangoObjectType):
class Meta: class Meta:
model = ShipModel model = ShipModel
interfaces = (relay.Node,) interfaces = (relay.Node,)
fields = "__all__"
@classmethod @classmethod
def get_node(cls, info, id): def get_node(cls, info, id):
@ -22,12 +23,14 @@ class Ship(DjangoObjectType):
class Character(DjangoObjectType): class Character(DjangoObjectType):
class Meta: class Meta:
model = CharacterModel model = CharacterModel
fields = "__all__"
class Faction(DjangoObjectType): class Faction(DjangoObjectType):
class Meta: class Meta:
model = FactionModel model = FactionModel
interfaces = (relay.Node,) interfaces = (relay.Node,)
fields = "__all__"
@classmethod @classmethod
def get_node(cls, info, id): def get_node(cls, info, id):