#NEWLINE# def remove_field( self , model , field ) : #NEWLINE# #INDENT# '\n        Removes a field from a model. Usually involves deleting a column,\n        but for M2Ms may involve deleting a table.\n        ' #NEWLINE# if ( field . many_to_many and field . remote_field . through . _meta . auto_created ) : #NEWLINE# #INDENT# return self . delete_model ( field . remote_field . through ) #NEWLINE# #UNINDENT# if ( field . db_parameters ( connection = self . connection ) [ 'type' ] is None ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# if field . remote_field : #NEWLINE# #INDENT# fk_names = self . _constraint_names ( model , [ field . column ] , foreign_key = True ) #NEWLINE# for fk_name in fk_names : #NEWLINE# #INDENT# self . execute ( self . _delete_constraint_sql ( self . sql_delete_fk , model , fk_name ) ) #NEWLINE# #UNINDENT# #UNINDENT# sql = ( self . sql_delete_column % { #NEWLINE# #INDENT# 'table' : self . quote_name ( model . _meta . db_table ) , #NEWLINE# 'column' : self . quote_name ( field . column ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . execute ( sql ) #NEWLINE# if self . connection . features . connection_persists_old_columns : #NEWLINE# #INDENT# self . connection . close ( )