#28900: QuerySet.values() and values_list() for compound queries fails with
annotation.
-------------------------------------+-------------------------------------
     Reporter:  elliott-omosheye     |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  1.11
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  union, values        |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by David Sanders):

 * cc: David Sanders (added)


Comment:

 If it helps, while checking if #34945 was a duplicate of this I was able
 to boil down the failure to this simple example:

 {{{
 class Foo(Model):
     name = CharField()

 class Bar(Model):
     name = CharField()

 qs = (
     Foo.objects.annotate(alias=F("name"))
     .union(Bar.objects.annotate(alias=F("name")))
     .values("alias")
 )
 print(qs)
 }}}

 gives

 {{{
 <QuerySet [{'alias': 1}, {'alias': 1}]>
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28900#comment:10>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018ba03184f9-1dea6a59-7b25-4b63-be82-727c6218e1a4-000000%40eu-central-1.amazonses.com.

Reply via email to