Convert any types (strings usualy) to integer

This commit is contained in:
m0sth8 2013-08-28 20:01:27 +04:00
parent 711fb9761c
commit 4be4dccc91

View File

@ -777,6 +777,12 @@ class IntegerField(WritableField):
raise ValidationError(self.error_messages['invalid'])
return value
def to_native(self, value):
value = super(IntegerField, self).to_native(value)
if value is None:
return value
return int(value)
class FloatField(WritableField):
type_name = 'FloatField'