diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 9f2a234d233..467d13a6f43 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -579,7 +579,7 @@ class CharField(Field): def get_prep_value(self, value): return self.to_python(value) - + def formfield(self, **kwargs): # Passing max_length to forms.CharField means that the value's length # will be validated twice. This is considered acceptable since we want @@ -884,8 +884,9 @@ class IntegerField(Field): return int(value) def get_prep_lookup(self, lookup_type, value): - if lookup_type == 'gte' or lookup_type == 'lt': - value = math.ceil(value) + if (lookup_type == 'gte' or lookup_type == 'lt') \ + and isinstance(value, float): + value = math.ceil(value) return super(IntegerField, self).get_prep_lookup(lookup_type, value) def get_internal_type(self):