diff --git a/graphene_django/converter.py b/graphene_django/converter.py index c40313d..3b3e18d 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -71,7 +71,8 @@ def convert_django_field_with_choices(field, registry=None): return named_choices_descriptions[self.name] enum = Enum(name, list(named_choices), type=EnumWithDescriptionsType) - converted = enum(description=field.help_text, required=not field.null) + required = not (field.blank or field.null or field.default) + converted = enum(description=field.help_text, required=required) else: converted = convert_django_field(field, registry) if registry is not None: diff --git a/graphene_django/tests/test_types.py b/graphene_django/tests/test_types.py index 8a8643b..5be1774 100644 --- a/graphene_django/tests/test_types.py +++ b/graphene_django/tests/test_types.py @@ -120,7 +120,7 @@ type Article implements Node { pubDateTime: DateTime! reporter: Reporter! editor: Reporter! - lang: ArticleLang! + lang: ArticleLang importance: ArticleImportance } @@ -166,7 +166,7 @@ type Reporter { lastName: String! email: String! pets: [Reporter] - aChoice: ReporterAChoice! + aChoice: ReporterAChoice reporterType: ReporterReporterType articles(before: String, after: String, first: Int, last: Int): ArticleConnection }