#16735: Queryset values should be aliasable
-------------------------------------+-------------------------------------
     Reporter:  alex.latchford@…     |                    Owner:  nate_b
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  1.3
  (models, ORM)                      |               Resolution:
     Severity:  Normal               |             Triage Stage:  Accepted
     Keywords:  queryset, alias,     |      Needs documentation:  0
  values                             |  Patch needs improvement:  1
    Has patch:  1                    |                    UI/UX:  0
  Needs tests:  0                    |
Easy pickings:  0                    |
-------------------------------------+-------------------------------------
Changes (by lrekucki):

 * needs_better_patch:  0 => 1


Comment:

 While adding this to {{{values()}}} is perfectly fine, doing the same with
 {{{values_list()}}} feels weird. Also, it's buggy:

 {{{#!python
 # from ValuesListQuerySet in the patch
 fields = list(self._fields) + self._aliased_fields.keys()
 }}}

 This makes the order of values in returned tuples depend on order of
 dictionary keys, which is _undefined_. Just try:

 {{{#!python
 print Model.objects.values_list(a2="field", a3="other_field")
 # on Python 2.7 and 3.2 values should be reversed.
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/16735#comment:3>
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.

Reply via email to