#9619: to_python not called when fetching data with .values(...)
---------------------------------------------------+------------------------
Reporter: Valera Grishin | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: SVN
Resolution: | Keywords:
values,custom field, datetime
Stage: Design decision needed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
---------------------------------------------------+------------------------
Comment (by olau):
Hey, while we're waiting for a design decision, could we please get a
quick fix on this that updates the documentation? It never has occurred to
me that values() wouldn't deserialize, I've always thought it would just
be an easy way to get plain dicts/tuples instead of the heavier objects,
and the documentation doesn't mention raw values at all:
"Returns a ValuesQuerySet -- a QuerySet that returns dictionaries when
used as an iterable, rather than model-instance objects.
Each of those dictionaries represents an object, with the keys
corresponding to the attribute names of model objects."
I have been using values() for a couple of years without noticing the
difference before today, where it broke on me because I've defined a
custom field.
Here's a suggestion for a wording: "Note that the values returned are
directly from the database, no field-specific conversions are performed,
e.g. for custom fields with to_python()."
Otherwise, +1 for getting this fixed, with raw=True/False or whatever. :)
--
Ticket URL: <http://code.djangoproject.com/ticket/9619#comment:10>
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.