#NEWLINE# def recalculate_global_quotas( self ) : #NEWLINE# #INDENT# self . stdout . write ( 'Recalculating global quotas' ) #NEWLINE# for model in get_models_with_quotas ( ) : #NEWLINE# #INDENT# if hasattr ( model , 'GLOBAL_COUNT_QUOTA_NAME' ) : #NEWLINE# #INDENT# with transaction . atomic ( ) : #NEWLINE# #INDENT# ( quota , _ ) = models . Quota . objects . get_or_create ( name = model . GLOBAL_COUNT_QUOTA_NAME ) #NEWLINE# quota . usage = model . objects . count ( ) #NEWLINE# quota . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . stdout . write ( '...done' )