Skip to content

Commit

Permalink
Register decimals as string
Browse files Browse the repository at this point in the history
  • Loading branch information
ulgens committed Dec 23, 2020
1 parent 558288a commit ef272cf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion graphene_django/filter/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ class Meta:
field = DjangoFilterConnectionField(ArticleNode, filterset_class=ArticleIdFilter)
max_time = field.args["max_time"]
assert isinstance(max_time, Argument)
assert max_time.type == Float
assert max_time.type == String
assert max_time.description == "The maximum time"


Expand Down
2 changes: 1 addition & 1 deletion graphene_django/forms/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def convert_form_field(field):

@convert_form_field.register(forms.fields.BaseTemporalField)
@convert_form_field.register(forms.CharField)
@convert_form_field.register(forms.DecimalField)
@convert_form_field.register(forms.EmailField)
@convert_form_field.register(forms.SlugField)
@convert_form_field.register(forms.URLField)
Expand Down Expand Up @@ -51,7 +52,6 @@ def convert_form_field_to_nullboolean(field):
return Boolean(description=field.help_text)


@convert_form_field.register(forms.DecimalField)
@convert_form_field.register(forms.FloatField)
def convert_form_field_to_float(field):
return Float(description=field.help_text, required=field.required)
Expand Down
8 changes: 4 additions & 4 deletions graphene_django/forms/tests/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def test_should_char_convert_string():
assert_conversion(forms.CharField, String)


def test_should_decimal_convert_string():
assert_conversion(forms.DecimalField, String)


def test_should_email_convert_string():
assert_conversion(forms.EmailField, String)

Expand Down Expand Up @@ -97,10 +101,6 @@ def test_should_float_convert_float():
assert_conversion(forms.FloatField, Float)


def test_should_decimal_convert_float():
assert_conversion(forms.DecimalField, Float)


def test_should_multiple_choice_convert_list():
field = forms.MultipleChoiceField()
graphene_type = convert_form_field(field)
Expand Down

0 comments on commit ef272cf

Please sign in to comment.