diff --git a/graphene/contrib/django/converter.py b/graphene/contrib/django/converter.py index 93420964..7f95dd8f 100644 --- a/graphene/contrib/django/converter.py +++ b/graphene/contrib/django/converter.py @@ -26,12 +26,12 @@ def convert_django_field(field): @convert_django_field.register(models.URLField) @convert_django_field.register(models.UUIDField) def _(field): - return StringField(description=field.description) + return StringField(description=field.help_text) @convert_django_field.register(models.AutoField) def _(field): - return IDField(description=field.description) + return IDField(description=field.help_text) @convert_django_field.register(models.PositiveIntegerField) @@ -40,22 +40,22 @@ def _(field): @convert_django_field.register(models.BigIntegerField) @convert_django_field.register(models.IntegerField) def _(field): - return IntField(description=field.description) + return IntField(description=field.help_text) @convert_django_field.register(models.BooleanField) def _(field): - return BooleanField(description=field.description, required=True) + return BooleanField(description=field.help_text, required=True) @convert_django_field.register(models.NullBooleanField) def _(field): - return BooleanField(description=field.description) + return BooleanField(description=field.help_text) @convert_django_field.register(models.FloatField) def _(field): - return FloatField(description=field.description) + return FloatField(description=field.help_text) @convert_django_field.register(models.ManyToManyField) @@ -68,4 +68,4 @@ def _(field): @convert_django_field.register(models.OneToOneField) @convert_django_field.register(models.ForeignKey) def _(field): - return DjangoModelField(field.related_model, description=field.description) + return DjangoModelField(field.related_model, description=field.help_text) diff --git a/graphene/core/fields.py b/graphene/core/fields.py index 02263ad2..69e831ff 100644 --- a/graphene/core/fields.py +++ b/graphene/core/fields.py @@ -100,6 +100,7 @@ class Field(object): internal_type = self.internal_type(schema) if not internal_type: raise Exception("Internal type for field %s is None" % self) + return GraphQLField( internal_type, description=self.description, diff --git a/tests/contrib_django/test_converter.py b/tests/contrib_django/test_converter.py index 23a523ac..8c046997 100644 --- a/tests/contrib_django/test_converter.py +++ b/tests/contrib_django/test_converter.py @@ -15,9 +15,10 @@ from .models import Article, Reporter def assert_conversion(django_field, graphene_field, *args): - field = django_field(*args) + field = django_field(*args, help_text='Custom Help Text') graphene_type = convert_django_field(field) assert isinstance(graphene_type, graphene_field) + assert graphene_type.description == 'Custom Help Text' return graphene_type