summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Tracey <kmtracey@gmail.com>2010-03-20 20:01:06 +0000
committerKaren Tracey <kmtracey@gmail.com>2010-03-20 20:01:06 +0000
commit10884ec2ebee152350c661c1356519ecd21084a5 (patch)
tree2c32d6a5d2f4d3d18e692b131d3c85b411338e62
parent9150fb6b0cb9113ba25cf2c79c0c3cd02d7cf1a0 (diff)
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
-rw-r--r--django/db/models/fields/__init__.py7
1 files 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):