Opened 17 years ago
Last modified 10 years ago
#10045 closed
bug in aggregations: .annotate() followed by .filter() on related field breaks — at Initial Version
| Reported by: | Owned by: | ||
|---|---|---|---|
| Component: | Documentation | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I get something that looks like a missing join condition when doing
ModelA.objects.all().annotate(num_b=Count('modelb')).filter(modelb__somebool=True)[0].num_b
I get num_b = 2^i for i objects of ModelB instead of num_b=i as I would expect to.
Please see attached models.py file for the Model definition and test case.
django revision: 9756
Note:
See TracTickets
for help on using tickets.