#NEWLINE# def get_aggregate( self , first_day , last_day , date_field , aggregate_field , aggregate_class ) : #NEWLINE# #INDENT# kwargs = { #NEWLINE# #INDENT# ( '%s__range' % date_field ) : ( first_day , last_day ) , #NEWLINE# #UNINDENT# } #NEWLINE# agg = self . qs . filter ( ** kwargs ) . aggregate ( agg = aggregate_class ( date_field ) ) #NEWLINE# return agg [ 'agg' ]