id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux
3982 Allow Field subclasses to coerce arbitrary Python types Marty Alchin nobody In working with a recent !DurationField patch (#2443), I noticed that Django seems to rely on the backend database driver to coerce data into native Python types. However, when adding new fields with non-standard mappings (such as !FloatField for storage, but timedelta as a native type, as in !DurationField), `to_python` needs to be called explicitly when populating an object from the database in order to be usable. This simple patch does just that, using `to_python` to coerce native Python types, after whatever coercion might be done by the database. closed Database layer (models, ORM) master fixed coerce coercion jm.bugtracking@… elsdoerfer@… Unreviewed 1 1 1 1