Changes between Initial Version and Version 1 of Ticket #34145, comment 3
- Timestamp:
- Nov 9, 2022, 9:16:17 AM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34145, comment 3
initial v1 45 45 If you want to give it a shot yourself and see how the test suite behaves to propose a patch here are the two locations you should look into 46 46 1. `annotate` method which sets `query.group_by` when an annotation of an aggregate is made ([https://github.com/django/django/blob/d6fbfea08d9bae4165df6a0cfbd4520b5e2242b2/django/db/models/query.py#L1660-L1665 source]) 47 2. `set_values` method which further adjust the group by based on the provided values ([https://github.com/django/django/blob/d6fbfea08d9bae4165df6a0cfbd4520b5e2242b2/django/db/models/sql/query.py#L2446-L2464 source )47 2. `set_values` method which further adjust the group by based on the provided values ([https://github.com/django/django/blob/d6fbfea08d9bae4165df6a0cfbd4520b5e2242b2/django/db/models/sql/query.py#L2446-L2464 source]) 48 48 49 My guess is that you'll want to adjust 1. to raise an exception `if instance(clone.query.group_by, tuple) and any(expr.contains_aggregate for expr in clone.query)` .49 My guess is that you'll want to adjust 1. to raise an exception `if instance(clone.query.group_by, tuple) and any(expr.contains_aggregate for expr in clone.query)` in the `if alias in annotations and annotation.contains_aggregate` branch.