Changes between Version 3 and Version 4 of Ticket #33050


Ignore:
Timestamp:
Aug 24, 2021, 11:51:38 AM (3 years ago)
Author:
Sunkyue
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #33050 – Description

    v3 v4  
    6363can solve the problem I think.
    6464
     65my current monkey-patching code is,
     66{{{
     67from django.db.models.sql.query import Query
     68
     69old_get_aggregation = Query.get_aggregation
     70
     71def 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
     75        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
     80
     81Query.get_aggregation = get_aggregation
     82}}}
     83
    6584reproduced on on 3.2.5/3.2.6
Back to Top