#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# cache_alias = options [ 'cache_alias' ] #NEWLINE# db_alias = options [ 'db_alias' ] #NEWLINE# verbosity = int ( options [ 'verbosity' ] ) #NEWLINE# models = [ ] #NEWLINE# for arg in args : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# models . extend ( apps . get_app_config ( arg ) . get_models ( ) ) #NEWLINE# #UNINDENT# except LookupError : #NEWLINE# #INDENT# app_label = '.' . join ( arg . split ( '.' ) [ : ( - 1 ) ] ) #NEWLINE# model_name = arg . split ( '.' ) [ ( - 1 ) ] #NEWLINE# models . append ( apps . get_model ( app_label , model_name ) ) #NEWLINE# #UNINDENT# #UNINDENT# cache_str = ( '' if ( cache_alias is None ) else ( "on cache '%s'" % cache_alias ) ) #NEWLINE# db_str = ( '' if ( db_alias is None ) else ( "for database '%s'" % db_alias ) ) #NEWLINE# keys_str = ( ( 'keys for %s models' % len ( models ) ) if args else 'all keys' ) #NEWLINE# if ( verbosity > 0 ) : #NEWLINE# #INDENT# self . stdout . write ( ( ' ' . join ( filter ( bool , [ 'Invalidating' , keys_str , cache_str , db_str ] ) ) + '...' ) ) #NEWLINE# #UNINDENT# invalidate ( * models , cache_alias = cache_alias , db_alias = db_alias ) #NEWLINE# if ( verbosity > 0 ) : #NEWLINE# #INDENT# self . stdout . write ( 'Cache keys successfully invalidated.' )