#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
-------------------------------------+-------------------------------------
Changes (by Sarah Boyce):
* cc: Simon Charette (added)
* stage: Unreviewed => Accepted
* summary: Weird behavior of .values after a distinct in 5.1.8 =>
values() raises a FieldError when multiple values() of annotated
values are chained
* version: 5.1 => 5.0
Comment:
Thank you Joseph! Appreciate the back and forth
Bisected it cb13792938f2c887134eb6b5164d89f8d8f9f1bd a change in 5.0
I can also simplify the query a little bit to
`Mapping.objects.values('id').annotate(foo=F('foo__name'),
foo_id=F('foo_id')).values('foo').values('foo_id')` and so have tried to
rewrite the ticket title
--
Ticket URL: <
https://code.djangoproject.com/ticket/36352#comment:9>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.