mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-04-14 06:04:23 +03:00
Merge branch 'graphql-python:main' into main
This commit is contained in:
commit
30776105e4
|
@ -70,7 +70,7 @@ Let's get started with these models:
|
|||
class Ingredient(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
notes = models.TextField()
|
||||
category = models.ForeignKey(Category, related_name='ingredients')
|
||||
category = models.ForeignKey(Category, related_name='ingredients', on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
graphene>=2.1,<3
|
||||
graphene-django>=2.1,<3
|
||||
graphql-core>=2.1,<3
|
||||
django==3.1.8
|
||||
django==3.1.14
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
graphene>=2.1,<3
|
||||
graphene-django>=2.1,<3
|
||||
graphql-core>=2.1,<3
|
||||
django==3.1.8
|
||||
django==3.1.14
|
||||
django-filter>=2
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user