#12239: Float is rounded to integer on queries on integer field
---------------------------------------------------+------------------------
          Reporter:  waverider                     |         Owner:  nobody     
                 
            Status:  new                           |     Milestone:  1.2        
                 
         Component:  Database layer (models, ORM)  |       Version:  1.1        
                 
        Resolution:                                |      Keywords:  __gte, 
__lte, query rounding
             Stage:  Accepted                      |     Has_patch:  1          
                 
        Needs_docs:  0                             |   Needs_tests:  0          
                 
Needs_better_patch:  1                             |  
---------------------------------------------------+------------------------
Changes (by SmileyChris):

  * needs_better_patch:  0 => 1

Comment:

 Flooring a 'gt' is fine, because `field__gt=11.1` will floor to 11, which
 will still match field=12.

 There's a problem with 'lt' too though, because `field__lt=12.1` will
 floor to 12 which *should* still match field=12.

 I also think that the patch should still run through `get_prep_value`. My
 suggestion is to just `math.ceil` float & Decimal values (if 'gte' or
 'lt') and passing the result through super still.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/12239#comment:7>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to