#13844: Errors when using character fields for aggregation -------------------------------------+------------------------------------- Reporter: zegrep@… | Owner: wogan Type: Bug | Status: assigned Component: Database layer | Version: 1.2 (models, ORM) | Resolution: Severity: Normal | Triage Stage: Ready for Keywords: | checkin Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by akaariai):
* needs_better_patch: 1 => 0 * needs_tests: 1 => 0 * stage: Accepted => Ready for checkin Comment: There is a comment in Oracle's convert_values() which says that because to_python() is meant for validation, it should not be used for converting values. At least one possible problem is that the to_python() method raises `ValidationError` on problematic input, and that error doesn't fit here. I am proposing (and I am going to likely commit) [https://github.com/akaariai/django/commit/fe1e4f4e3ca3a70cdc3d327f9021b349fa75b431 a patch] which just removes the non-necessary float(value) from convert_values. This fixes PostgreSQL and MySQL. Oracle and SQLite already override the convert_values() method, and return the bare value in the "unknown field type" case. In addition, the suggestion made in the comments of this ticket that the conversion should be done by the field, not by the backend gets a +1 from me. It might be as straightforward as defining to_python() to do the conversion, but IMO it needs separate ticket and some more investigation. -- Ticket URL: <https://code.djangoproject.com/ticket/13844#comment:12> 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 post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.