Charfield choice with blank=True fix

This commit is contained in:
Zoltan Egyed 2018-09-25 18:34:57 +02:00
parent f76f38ef30
commit 6ed8269175
2 changed files with 4 additions and 3 deletions

View File

@ -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:

View File

@ -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
}