* status: new => closed
* owner: => ramiro
* resolution: => fixed
Comment:
In [16252]:
{{{
#!CommitTicketReference repository="" revision="16252"
Fixed #14476 -- Fixed resolution of automatically generated annotation
names so e.g. filtering based on them works. Thanks dirleyls for the
report and patch.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/14476#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: closed => reopened
* ui_ux: => 0
* resolution: fixed =>
* easy: => 0
Comment:
This is still a problem for aggregates.
{{{
>>> from django.contrib.auth.models import *
>>> from django.db.models import *
>>> User.objects.annotate(xyz=Count('groups')).aggregate(Max('xyz'))
{'xyz__max': 13}
>>> User.objects.annotate(Count('groups')).aggregate(Max('groups__count'))
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/mrmachine/django/db/models/query.py", line 331, in
aggregate
is_summary=True)
File "/Users/mrmachine/django/db/models/sql/query.py", line 1000, in
add_aggregate
field_list, opts, self.get_initial_alias(), False)
File "/Users/mrmachine/django/db/models/sql/query.py", line 1288, in
setup_joins
"Choices are: %s" % (name, ", ".join(names)))
FieldError: Cannot resolve keyword 'count' into field. Choices are: id,
name, permissions, user, groups__count
}}}
`exclude()`, `filter()`, `values()`, `values_list()` and `order_by()` all
work, so I assume that `aggregate()` should as well.
Can we apply the same fix? Let me know if I should open a new ticket
instead of re-opening this one.
--
Ticket URL: <https://code.djangoproject.com/ticket/14476#comment:5>
* version: 1.2 => master
* component: ORM aggregation => Database layer (models, ORM)
--
Ticket URL: <https://code.djangoproject.com/ticket/14476#comment:6>
* status: new => closed
* resolution: => fixed
Comment:
That test case is fixed by f59fd15c4928caf3dfcbd50f6ab47be409a43b01
(Django 1.8). I will commit the test.
--
Ticket URL: <https://code.djangoproject.com/ticket/14476#comment:8>
Comment (by Tim Graham <timograham@…>):
In [changeset:"3e1bb5cfb8f9676e0c045f0d101a094437133b54" 3e1bb5c]:
{{{
#!CommitTicketReference repository=""
revision="3e1bb5cfb8f9676e0c045f0d101a094437133b54"
Refs #14476 -- Added a test for default annotation name access in
aggregate.
Fixed in f59fd15c4928caf3dfcbd50f6ab47be409a43b01
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/14476#comment:9>