Skip to content

Commit a1dd2b6

Browse files
committed
Added FileField and ImageField conversion. Fixed #137
1 parent 1f548f1 commit a1dd2b6

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

graphene/contrib/django/converter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def convert_django_field(field):
3131
@convert_django_field.register(models.SlugField)
3232
@convert_django_field.register(models.URLField)
3333
@convert_django_field.register(models.GenericIPAddressField)
34+
@convert_django_field.register(models.FileField)
3435
@convert_django_field.register(UUIDField)
3536
def convert_field_to_string(field):
3637
return String(description=field.help_text)

graphene/contrib/django/tests/test_converter.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ def test_should_ipaddress_convert_string():
5353
assert_conversion(models.GenericIPAddressField, graphene.String)
5454

5555

56+
def test_should_file_convert_string():
57+
assert_conversion(models.FileField, graphene.String)
58+
59+
60+
def test_should_image_convert_string():
61+
assert_conversion(models.ImageField, graphene.String)
62+
63+
5664
def test_should_auto_convert_id():
5765
assert_conversion(models.AutoField, graphene.ID, primary_key=True)
5866

0 commit comments

Comments
 (0)