#NEWLINE# def count( self , key = None ) : #NEWLINE# #INDENT# qs = super ( StatsManager , self ) . get_queryset ( ) #NEWLINE# if qs : #NEWLINE# #INDENT# qs = qs . filter ( key = key ) #NEWLINE# #UNINDENT# return qs . aggregate ( Sum ( 'value' ) ) [ 'value__sum' ]