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:
Florian Schlachter 2010-01-31 18:06:25 +01:00
parent 73aff806f3
commit 10de19d38b

View File

@ -71,6 +71,7 @@ class FloatField(BaseField):
return float(value)
def validate(self, value):
if isinstance(value, int): value = float(value)
assert isinstance(value, float)
if self.min_value is not None and value < self.min_value: