Skip to content

Commit 7cd95a4

Browse files
committed
Register decimals as string
1 parent d07642a commit 7cd95a4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

graphene_django/filter/tests/test_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class Meta:
388388
field = DjangoFilterConnectionField(ArticleNode, filterset_class=ArticleIdFilter)
389389
max_time = field.args["max_time"]
390390
assert isinstance(max_time, Argument)
391-
assert max_time.type == Float
391+
assert max_time.type == String
392392
assert max_time.description == "The maximum time"
393393

394394

graphene_django/forms/converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def convert_form_field(field):
2020

2121
@convert_form_field.register(forms.fields.BaseTemporalField)
2222
@convert_form_field.register(forms.CharField)
23+
@convert_form_field.register(forms.DecimalField)
2324
@convert_form_field.register(forms.EmailField)
2425
@convert_form_field.register(forms.SlugField)
2526
@convert_form_field.register(forms.URLField)
@@ -51,7 +52,6 @@ def convert_form_field_to_nullboolean(field):
5152
return Boolean(description=field.help_text)
5253

5354

54-
@convert_form_field.register(forms.DecimalField)
5555
@convert_form_field.register(forms.FloatField)
5656
def convert_form_field_to_float(field):
5757
return Float(description=field.help_text, required=field.required)

graphene_django/forms/tests/test_converter.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ def test_should_char_convert_string():
5050
assert_conversion(forms.CharField, String)
5151

5252

53+
def test_should_decimal_convert_string():
54+
assert_conversion(forms.DecimalField, String)
55+
56+
5357
def test_should_email_convert_string():
5458
assert_conversion(forms.EmailField, String)
5559

@@ -97,10 +101,6 @@ def test_should_float_convert_float():
97101
assert_conversion(forms.FloatField, Float)
98102

99103

100-
def test_should_decimal_convert_float():
101-
assert_conversion(forms.DecimalField, Float)
102-
103-
104104
def test_should_multiple_choice_convert_connectionorlist():
105105
field = forms.ModelMultipleChoiceField(queryset=None)
106106
graphene_type = convert_form_field(field)

0 commit comments

Comments
 (0)