diff --git a/README.md b/README.md index 70191b67..924a63e0 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ A [Mongoengine](https://mongoengine-odm.readthedocs.io/) integration for [Graphe ## Installation -For instaling graphene-mongo, just run this command in your shell +For installing graphene-mongo, just run this command in your shell ``` pip install graphene-mongo diff --git a/README.rst b/README.rst index 9748bab2..993b28e1 100644 --- a/README.rst +++ b/README.rst @@ -15,7 +15,7 @@ A `Mongoengine `__ integration for `Gra Installation ------------ -For instaling graphene-mongo, just run this command in your shell +For installing graphene-mongo, just run this command in your shell .. code:: bash diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 6fd70be6..2ba31a63 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -64,7 +64,7 @@ Let's get start with following models: Schema ------ -Here I assume you guys have the basic knowledage of how schema works in GraphQL, that I define the *root type* as the `Query` class below with the ability to list all employees. +Here I assume you guys have the basic knowledge of how schema works in GraphQL, that I define the *root type* as the `Query` class below with the ability to list all employees. .. code:: python diff --git a/examples/flask_mongoengine/app.py b/examples/flask_mongoengine/app.py index 659becc9..9f81a3fa 100644 --- a/examples/flask_mongoengine/app.py +++ b/examples/flask_mongoengine/app.py @@ -47,4 +47,3 @@ if __name__ == '__main__': init_db() app.run() - diff --git a/examples/flask_mongoengine/schema.py b/examples/flask_mongoengine/schema.py index 9715751e..1377ca35 100644 --- a/examples/flask_mongoengine/schema.py +++ b/examples/flask_mongoengine/schema.py @@ -6,6 +6,7 @@ from models import Role as RoleModel from models import Task as TaskModel + class Department(MongoengineObjectType): class Meta: @@ -26,6 +27,7 @@ class Meta: model = TaskModel interfaces = (Node,) + class Employee(MongoengineObjectType): class Meta: @@ -39,5 +41,5 @@ class Query(graphene.ObjectType): all_roles = MongoengineConnectionField(Role) role = graphene.Field(Role) -schema = graphene.Schema(query=Query, types=[Department, Employee, Role]) +schema = graphene.Schema(query=Query, types=[Department, Employee, Role]) diff --git a/graphene_mongo/tests/models.py b/graphene_mongo/tests/models.py index 06403c63..e06125ca 100644 --- a/graphene_mongo/tests/models.py +++ b/graphene_mongo/tests/models.py @@ -45,7 +45,7 @@ class Article(mongoengine.Document): help_text="The date of first press.") editor = mongoengine.ReferenceField(Editor) reporter = mongoengine.ReferenceField('Reporter') - # Will not convert this field cause no chioces + # Will not convert this field cause no choices generic_reference = mongoengine.GenericReferenceField() @@ -69,14 +69,6 @@ class Reporter(mongoengine.Document): articles = mongoengine.ListField(mongoengine.ReferenceField(Article)) embedded_articles = mongoengine.ListField(mongoengine.EmbeddedDocumentField(EmbeddedArticle)) embedded_list_articles = mongoengine.EmbeddedDocumentListField(EmbeddedArticle) - id = mongoengine.StringField(primary_key=True) - first_name = mongoengine.StringField(required=True) - last_name = mongoengine.StringField(required=True) - email = mongoengine.EmailField() - awards = mongoengine.ListField(mongoengine.StringField()) - articles = mongoengine.ListField(mongoengine.ReferenceField(Article)) - embedded_articles = mongoengine.ListField(mongoengine.EmbeddedDocumentField(EmbeddedArticle)) - embedded_list_articles = mongoengine.EmbeddedDocumentListField(EmbeddedArticle) generic_reference = mongoengine.GenericReferenceField( choices=[Article, Editor, ] ) diff --git a/graphene_mongo/types.py b/graphene_mongo/types.py index 36cb65dd..7ea46e50 100644 --- a/graphene_mongo/types.py +++ b/graphene_mongo/types.py @@ -21,7 +21,7 @@ def construct_fields(model, registry, only_fields, exclude_fields): exclude_fields ([str]): Returns: - (OrderedDict, OrderedDict): coverted fields and self reference fields. + (OrderedDict, OrderedDict): converted fields and self reference fields. """ _model_fields = get_model_fields(model) @@ -163,13 +163,12 @@ def rescan_fields(cls): mongoengine_fields = yank_fields_from_attrs(converted_fields, _as=graphene.Field) - # The initial scan should take precidence + # The initial scan should take precedence for field in mongoengine_fields: if field not in cls._meta.fields: cls._meta.fields.update({field: mongoengine_fields[field]}) # Self-referenced fields can't change between scans! - # noqa @classmethod def is_type_of(cls, root, info):