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
This commit is contained in:
Karen Tracey 2010-03-20 20:01:06 +00:00
parent 9150fb6b0c
commit 10884ec2eb
1 changed files with 4 additions and 3 deletions

View File

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