diff --git a/graphene_django/converter.py b/graphene_django/converter.py index da96161..c243e82 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -166,11 +166,19 @@ def convert_field_to_string(field, registry=None): ) +@convert_django_field.register(models.BigAutoField) @convert_django_field.register(models.AutoField) def convert_field_to_id(field, registry=None): return ID(description=get_django_field_description(field), required=not field.null) +if hasattr(models, "SmallAutoField"): + + @convert_django_field.register(models.SmallAutoField) + def convert_field_small_to_id(field, registry=None): + return convert_field_to_id(field, registry) + + @convert_django_field.register(models.UUIDField) def convert_field_to_uuid(field, registry=None): return UUID( diff --git a/graphene_django/tests/test_converter.py b/graphene_django/tests/test_converter.py index fe84e73..afd744f 100644 --- a/graphene_django/tests/test_converter.py +++ b/graphene_django/tests/test_converter.py @@ -111,6 +111,15 @@ def test_should_auto_convert_id(): assert_conversion(models.AutoField, graphene.ID, primary_key=True) +def test_should_big_auto_convert_id(): + assert_conversion(models.BigAutoField, graphene.ID, primary_key=True) + + +def test_should_small_auto_convert_id(): + if hasattr(models, "SmallAutoField"): + assert_conversion(models.SmallAutoField, graphene.ID, primary_key=True) + + def test_should_uuid_convert_id(): assert_conversion(models.UUIDField, graphene.UUID)