From 91365ff670939e9dbbf4e1dd187a6738fe8d4345 Mon Sep 17 00:00:00 2001 From: Paul Bailey Date: Wed, 23 Nov 2016 11:29:04 -0500 Subject: [PATCH] added timefield support --- graphene_django/converter.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/graphene_django/converter.py b/graphene_django/converter.py index 70b364c..37114b2 100644 --- a/graphene_django/converter.py +++ b/graphene_django/converter.py @@ -4,7 +4,7 @@ from django.utils.encoding import force_text from graphene import (ID, Boolean, Dynamic, Enum, Field, Float, Int, List, NonNull, String) from graphene.relay import is_node -from graphene.types.datetime import DateTime +from graphene.types.datetime import DateTime, Time from graphene.types.json import JSONString from graphene.utils.str_converters import to_camel_case, to_const from graphql import assert_valid_name @@ -112,6 +112,11 @@ def convert_date_to_string(field, registry=None): return DateTime(description=field.help_text, required=not field.null) +@convert_django_field.register(models.TimeField) +def convert_date_to_string(field, registry=None): + return Time(description=field.help_text, required=not field.null) + + @convert_django_field.register(models.OneToOneRel) def convert_onetoone_field_to_djangomodel(field, registry=None): model = get_related_model(field)