Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12239, again: Refined the original fix to avoid the test error…

…s introduced. Thanks pmclanahan.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12821 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 10884ec2ebee152350c661c1356519ecd21084a5 1 parent 9150fb6
Karen Tracey authored March 20, 2010

Showing 1 changed file with 4 additions and 3 deletions. Show diff stats Hide diff stats

  1. 7  django/db/models/fields/__init__.py
7  django/db/models/fields/__init__.py
@@ -579,7 +579,7 @@ def to_python(self, value):
579 579
 
580 580
     def get_prep_value(self, value):
581 581
         return self.to_python(value)
582  
-    
  582
+
583 583
     def formfield(self, **kwargs):
584 584
         # Passing max_length to forms.CharField means that the value's length
585 585
         # will be validated twice. This is considered acceptable since we want
@@ -884,8 +884,9 @@ def get_prep_value(self, value):
884 884
         return int(value)
885 885
 
886 886
     def get_prep_lookup(self, lookup_type, value):
887  
-        if lookup_type == 'gte' or lookup_type == 'lt':
888  
-            value = math.ceil(value)
  887
+        if (lookup_type == 'gte' or lookup_type == 'lt') \
  888
+           and isinstance(value, float):
  889
+                value = math.ceil(value)
889 890
         return super(IntegerField, self).get_prep_lookup(lookup_type, value)
890 891
 
891 892
     def get_internal_type(self):

0 notes on commit 10884ec

Please sign in to comment.
Something went wrong with that request. Please try again.