#NEWLINE# def _setup_aggregate_query( self , aggregates ) : #NEWLINE# #INDENT# '\n        Prepare the query for computing a result that contains aggregate annotations.\n        ' #NEWLINE# opts = self . model . _meta #NEWLINE# if ( self . query . group_by is None ) : #NEWLINE# #INDENT# field_names = [ f . attname for f in opts . fields ] #NEWLINE# self . query . add_fields ( field_names , False ) #NEWLINE# self . query . set_group_by ( )