Changes between Version 4 and Version 5 of Ticket #33050
- Timestamp:
- Aug 24, 2021, 12:04:43 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #33050 – Description
v4 v5 45 45 }}} 46 46 47 reproduced on on 3.2.5/3.2.6 48 49 47 50 suggested fix: 48 51 on django.db.models.sql.query.py -> Query.get_aggregation, from … … 59 62 combined_query.select_related = False 60 63 inner_query.set_annotation_mask(self.annotation_select) 61 62 64 }}} 63 65 can solve the problem I think. … … 70 72 71 73 def get_aggregation(self, using, added_aggregate_names): 72 original_select_related_values = {} 73 for combined_query in self.combined_queries: 74 original_select_related_values[combined_query] = combined_query.select_related 74 cloned_self = self.clone() 75 for combined_query in cloned_self.combined_queries: 75 76 combined_query.select_related = False 76 result = old_get_aggregation(self, using, added_aggregate_names) 77 for combined_query in self.combined_queries: 78 combined_query.select_related = original_select_related_values[combined_query] 79 return result 77 return old_get_aggregation(cloned_self, using, added_aggregate_names) 80 78 81 79 Query.get_aggregation = get_aggregation 82 80 }}} 83 84 reproduced on on 3.2.5/3.2.6