From d13d7c0f68acbcae1c7c9d7731a9b4aa7ba81325 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Mon, 2 Nov 2015 19:36:49 -0800 Subject: [PATCH] Improved django example --- examples/starwars_django/schema.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/starwars_django/schema.py b/examples/starwars_django/schema.py index e7530ecf..21b29a1f 100644 --- a/examples/starwars_django/schema.py +++ b/examples/starwars_django/schema.py @@ -12,7 +12,6 @@ schema = graphene.Schema(name='Starwars Django Relay Schema') class Ship(DjangoNode): - class Meta: model = ShipModel @@ -21,15 +20,12 @@ class Ship(DjangoNode): return Ship(get_ship(id)) -@schema.register class Character(DjangoObjectType): - class Meta: model = CharacterModel class Faction(DjangoNode): - class Meta: model = FactionModel @@ -39,7 +35,6 @@ class Faction(DjangoNode): class IntroduceShip(relay.ClientIDMutation): - class Input: ship_name = graphene.StringField(required=True) faction_id = graphene.StringField(required=True) @@ -79,5 +74,9 @@ class Mutation(graphene.ObjectType): introduce_ship = graphene.Field(IntroduceShip) +# We register the Character Model because if not would be +# inaccessible for the schema +schema.register(Character) + schema.query = Query schema.mutation = Mutation