mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-11 00:32:24 +03:00
make small auto optional
This commit is contained in:
parent
f04767178e
commit
a135494078
|
@ -166,13 +166,21 @@ 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.BigAutoField)
|
||||||
@convert_django_field.register(models.AutoField)
|
@convert_django_field.register(models.AutoField)
|
||||||
def convert_field_to_id(field, registry=None):
|
def convert_field_to_id(field, registry=None):
|
||||||
return ID(description=get_django_field_description(field), required=not field.null)
|
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_to_id(field, registry=None):
|
||||||
|
return ID(
|
||||||
|
description=get_django_field_description(field), required=not field.null
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@convert_django_field.register(models.UUIDField)
|
@convert_django_field.register(models.UUIDField)
|
||||||
def convert_field_to_uuid(field, registry=None):
|
def convert_field_to_uuid(field, registry=None):
|
||||||
return UUID(
|
return UUID(
|
||||||
|
|
|
@ -116,7 +116,7 @@ def test_should_big_auto_convert_id():
|
||||||
|
|
||||||
|
|
||||||
def test_should_small_auto_convert_id():
|
def test_should_small_auto_convert_id():
|
||||||
if hasattr(models, 'SmallAutoField'):
|
if hasattr(models, "SmallAutoField"):
|
||||||
assert_conversion(models.SmallAutoField, graphene.ID, primary_key=True)
|
assert_conversion(models.SmallAutoField, graphene.ID, primary_key=True)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user