diff --git a/graphene_django/converter.py b/graphene_django/converter.py index 121c1de1..ef6d640e 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -183,19 +183,13 @@ def convert_field_to_string(field, registry=None): ) +@convert_django_field.register(models.SmallAutoField) @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/filter/filterset.py b/graphene_django/filter/filterset.py index 7e0d0c52..78af9cf2 100644 --- a/graphene_django/filter/filterset.py +++ b/graphene_django/filter/filterset.py @@ -11,6 +11,8 @@ GRAPHENE_FILTER_SET_OVERRIDES = { models.AutoField: {"filter_class": GlobalIDFilter}, + models.BigAutoField: {"filter_class": GlobalIDFilter}, + models.SmallAutoField: {"filter_class": GlobalIDFilter}, models.OneToOneField: {"filter_class": GlobalIDFilter}, models.ForeignKey: {"filter_class": GlobalIDFilter}, models.ManyToManyField: {"filter_class": GlobalIDMultipleChoiceFilter}, diff --git a/graphene_django/tests/test_converter.py b/graphene_django/tests/test_converter.py index e8c09208..69913aef 100644 --- a/graphene_django/tests/test_converter.py +++ b/graphene_django/tests/test_converter.py @@ -115,8 +115,7 @@ def test_should_big_auto_convert_id(): def test_should_small_auto_convert_id(): - if hasattr(models, "SmallAutoField"): - assert_conversion(models.SmallAutoField, graphene.ID, primary_key=True) + assert_conversion(models.SmallAutoField, graphene.ID, primary_key=True) def test_should_uuid_convert_id():