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

Comment (by jarshwah):

 Just quickly, with the changes to annotate that have landed, it is now
 possible to create aliases yourself, and reference them from the values
 call:

 {{{
 
Model.objects.annotate(my_alias=F('some__long__name__to__alias')).values('my_alias')
 }}}

 This is fairly similar to the suggestion Anssi made upthread of using a
 new method `alias()`. Not sure if this would be preferable though, as it
 is more verbose and requires an extra round of queryset copying.

--
Ticket URL: <https://code.djangoproject.com/ticket/16735#comment:21>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/094.a4796dce8258771a38941c77e3396382%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to