be kind and also accept an integer for a float field (so e.g. mymodel.floatfield = 9 is possible, instead of mymodel.floatfield = 9.0)
This commit is contained in:
parent
73aff806f3
commit
10de19d38b
@ -71,6 +71,7 @@ class FloatField(BaseField):
|
|||||||
return float(value)
|
return float(value)
|
||||||
|
|
||||||
def validate(self, value):
|
def validate(self, value):
|
||||||
|
if isinstance(value, int): value = float(value)
|
||||||
assert isinstance(value, float)
|
assert isinstance(value, float)
|
||||||
|
|
||||||
if self.min_value is not None and value < self.min_value:
|
if self.min_value is not None and value < self.min_value:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user