From 10884ec2ebee152350c661c1356519ecd21084a5 Mon Sep 17 00:00:00 2001 From: Karen Tracey Date: Sat, 20 Mar 2010 20:01:06 +0000 Subject: [PATCH] Fixed #12239, again: Refined the original fix to avoid the test errors introduced. Thanks pmclanahan. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12821 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/db/models/fields/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 9f2a234d23..467d13a6f4 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):