﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
8233	Decimal Field can accept float value	Michel Sabchuk	nobody	"The Decimal Field accepts the following types:

 * a ''decimal.Decimal'' instance value;
 * a string representation of a float;

What about to accept float values too? The float value can be converted using the DecimalField ''format_number'' method, see the code above:

{{{
    def to_python(self, value):
        if value is None:
            return value
        try:
            # if the value is a float, convert it to a string and let decimal.Decimal do the work
            if isinstance(value, float):
                value = self.format_number(value)
            return decimal.Decimal(value)
        except decimal.InvalidOperation:
            raise validators.ValidationError(
                _(""This value must be a decimal number.""))
}}}"		closed	Validators	dev		wontfix		michelts@…	Unreviewed	1	0	0	0	0	0
