#10256 closed (fixed)
values() and values_list() either include all or no columns from the extra(select=) clause
Reported by: | Russell Keith-Magee | Owned by: | Russell Keith-Magee |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
By way of example, this is what 1.0.X produces:
>>> Book.objects.extra(select={'a':'name','b':'price','c':'pages'}).values('name','pages','a') [{'a': u'Book 1', 'c': 11, 'b': Decimal("11.11"), 'name': u'Book 1', 'pages': 11}, ... >>> Book.objects.extra(select={'a':'name','b':'price','c':'pages'}).values('name','pages') [{'name': u'Book 1', 'pages': 11}, ...
That is, if you don't explicitly mention an extra selected column in the values() clause, they are omitted (as expected). However, as soon as you include a single extra column, _all_ extra columns are included in the returned values.
Analogous behavior exists for values_list().
Change History (3)
comment:1 by , 16 years ago
Owner: | changed from | to
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 16 years ago
Note:
See TracTickets
for help on using tickets.
I'm working on this - I should commit a fix shortly.