mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 01:32:24 +03:00
Convert nullable BooleanField to nullable Boolean.
BooleanFields can now be made nullable using `null=True` in Django. Graphene used to convert all BooleanFields to a NonNull type; this commit fixes converting nullable BooleanFields. Fixes #486.
This commit is contained in:
parent
b66a3f3479
commit
c6e022caf8
|
@ -127,13 +127,9 @@ def convert_field_to_int(field, registry=None):
|
|||
return Int(description=field.help_text, required=not field.null)
|
||||
|
||||
|
||||
@convert_django_field.register(models.NullBooleanField)
|
||||
@convert_django_field.register(models.BooleanField)
|
||||
def convert_field_to_boolean(field, registry=None):
|
||||
return NonNull(Boolean, description=field.help_text)
|
||||
|
||||
|
||||
@convert_django_field.register(models.NullBooleanField)
|
||||
def convert_field_to_nullboolean(field, registry=None):
|
||||
return Boolean(description=field.help_text, required=not field.null)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user