From 27a7c0e299964567f96886676ee1d139835071f5 Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Tue, 5 Jun 2018 14:39:51 -0700 Subject: [PATCH] Added support for FilePathField --- graphene_django/converter.py | 1 + graphene_django/tests/test_converter.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/graphene_django/converter.py b/graphene_django/converter.py index 30dcb5e..da73ede 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -80,6 +80,7 @@ def convert_django_field(field, registry=None): @convert_django_field.register(models.URLField) @convert_django_field.register(models.GenericIPAddressField) @convert_django_field.register(models.FileField) +@convert_django_field.register(models.FilePathField) def convert_field_to_string(field, registry=None): return String(description=field.help_text, required=not field.null) diff --git a/graphene_django/tests/test_converter.py b/graphene_django/tests/test_converter.py index 3dd2963..bcf4564 100644 --- a/graphene_django/tests/test_converter.py +++ b/graphene_django/tests/test_converter.py @@ -82,6 +82,10 @@ def test_should_image_convert_string(): assert_conversion(models.ImageField, graphene.String) +def test_should_url_convert_string(): + assert_conversion(models.FilePathField, graphene.String) + + def test_should_auto_convert_id(): assert_conversion(models.AutoField, graphene.ID, primary_key=True)