#15947: get_FIELD_display doesn't work when a given field is an IntegerField
and is
assigned a string value
-------------------------------------+-------------------------------------
Reporter: phuihock | Owner: nobody
Type: Bug | Status: closed
Milestone: | Component: Database layer
Version: 1.3 | (models, ORM)
Resolution: wontfix | Severity: Normal
Triage Stage: Accepted | Keywords:
Needs documentation: 0 | Has patch: 1
Patch needs improvement: 0 | Needs tests: 1
| Easy pickings: 0
-------------------------------------+-------------------------------------
Comment (by julien):
Django does cast values but only at a few key stages, for example when
receiving data from a form (since browsers have different ways of
formatting data) or before saving to the database (i.e. with
`get_db_prep_value`). However, if you are manually and directly feeding
improper data to a field, as illustrated in your code sample above, then
you're on your own. It is your responsibility to provide sensibly
formatted data as long as it is within your control -- that is, be
pythonic. If you find yourself stuck because improper data is passed to a
field in a way that is outside of your control, then feel free to bring
the question up on the dev-list.
--
Ticket URL: <http://code.djangoproject.com/ticket/15947#comment:5>
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.