#NEWLINE# def handle( self , * args , **options ) : #NEWLINE# #INDENT# '\n        Command execution.\n        ' #NEWLINE# self . cursor = connection . cursor ( ) #NEWLINE# self . introspection = connection . introspection #NEWLINE# self . interactive = options [ 'interactive' ] #NEWLINE# found_missing_fields = False #NEWLINE# models = translator . get_registered_models ( abstract = False ) #NEWLINE# for model in models : #NEWLINE# #INDENT# db_table = model . _meta . db_table #NEWLINE# if ( django . VERSION < ( 1 , 8 ) ) : #NEWLINE# #INDENT# model_name = model . _meta . module_name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# model_name = model . _meta . model_name #NEWLINE# #UNINDENT# model_full_name = ( '%s.%s' % ( model . _meta . app_label , model_name ) ) #NEWLINE# opts = translator . get_options_for_model ( model ) #NEWLINE# for ( field_name , fields ) in opts . local_fields . items ( ) : #NEWLINE# #INDENT# field = list ( fields ) [ 0 ] #NEWLINE# column_name = ( field . db_column if field . db_column else field_name ) #NEWLINE# missing_langs = list ( self . get_missing_languages ( column_name , db_table ) ) #NEWLINE# if missing_langs : #NEWLINE# #INDENT# found_missing_fields = True #NEWLINE# print_missing_langs ( missing_langs , field_name , model_full_name ) #NEWLINE# sql_sentences = self . get_sync_sql ( field_name , missing_langs , model ) #NEWLINE# execute_sql = ask_for_confirmation ( sql_sentences , model_full_name , self . interactive ) #NEWLINE# if execute_sql : #NEWLINE# #INDENT# print ( 'Executing SQL...' ) #NEWLINE# for sentence in sql_sentences : #NEWLINE# #INDENT# self . cursor . execute ( db_table ) #NEWLINE# #UNINDENT# print ( 'Done' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# print ( 'SQL not executed' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if ( django . VERSION < ( 1 , 6 ) ) : #NEWLINE# #INDENT# transaction . commit_unless_managed ( ) #NEWLINE# #UNINDENT# if ( not found_missing_fields ) : #NEWLINE# #INDENT# print ( 'No new translatable fields detected' )