#36352: values() raises a FieldError when multiple values() of annotated values 
are
chained
-------------------------------------+-------------------------------------
     Reporter:  Joseph Yu            |                    Owner:  (none)
         Type:  Bug                  |                   Status:  new
    Component:  Database layer       |                  Version:  5.0
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  .values, distinct    |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):

 It looks like we could error out with a more appropriate message but we've
 made some significant changes in since 4.2 to prevent obscuring existing
 field references with annotations.

 In other words I would expect calls of the form
 `Mapping.objects.annotate(foo=F('foo__name'))` and
 `Mapping.objects.annotate(foo_id=F('foo_id'))` to always be problematic to
 some extent even when values is used as they turn follow up references to
 such annotations ambiguous.

 For example, what should
 `annotate(foo=F('foo__name')).filter(foo__name="Bar")` resolve to or
 surface as error?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36352#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 django-updates+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701967ff3a02f-42c50954-0d60-4263-a28c-1c412153d82e-000000%40eu-central-1.amazonses.com.

Reply via email to