#35821: Integer fields silently round floats
-------------------------------+--------------------------------------
     Reporter:  Alex Krupp     |                    Owner:  (none)
         Type:  Bug            |                   Status:  closed
    Component:  Uncategorized  |                  Version:  5.1
     Severity:  Normal         |               Resolution:  invalid
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  1              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Jacob Walls):

 * resolution:   => invalid
 * status:  new => closed

Comment:

 Thanks for the ticket, but it sounds like `FloatField` may be more
 appropriate for your use case. `IntegerField` is
 [https://docs.djangoproject.com/en/5.1/ref/models/fields/#integerfield
 documented] as representing integers, and since `int` and `float` are
 distinct Python types, and throughout the documentation is the theme that
 Django models coerce inputs to proper python types (sometimes implicitly,
 elsewhere explicitly in the discussion of
 
[https://docs.djangoproject.com/en/5.1/ref/models/fields/#django.db.models.Field.to_python
 to_python]), I think this behavior is sufficiently documented. Changing
 the underlying behavior would introduce backwards compatibility concerns.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35821#comment:1>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701926ebf08cd-261d268f-3d10-4d86-82dc-2df6ac6acd2b-000000%40eu-central-1.amazonses.com.

Reply via email to