#NEWLINE# def copy_fields( self , model ) : #NEWLINE# #INDENT# "\n        Creates copies of the model's original fields, returning\n        a dictionary mapping field name to copied field object.\n        " #NEWLINE# fields = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for field in model . _meta . fields : #NEWLINE# #INDENT# field = copy . copy ( field ) #NEWLINE# try : #NEWLINE# #INDENT# field . remote_field = copy . copy ( field . remote_field ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# field . rel = copy . copy ( field . rel ) #NEWLINE# #UNINDENT# if isinstance ( field , OrderWrt ) : #NEWLINE# #INDENT# field . __class__ = models . IntegerField #NEWLINE# #UNINDENT# if isinstance ( field , models . ForeignKey ) : #NEWLINE# #INDENT# old_field = field #NEWLINE# field_arguments = { #NEWLINE# #INDENT# 'db_constraint' : False , #NEWLINE# #UNINDENT# } #NEWLINE# if ( getattr ( old_field , 'one_to_one' , False ) or isinstance ( old_field , models . OneToOneField ) ) : #NEWLINE# #INDENT# FieldType = models . ForeignKey #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# FieldType = type ( old_field ) #NEWLINE# #UNINDENT# if getattr ( old_field , 'to_fields' , [ ] ) : #NEWLINE# #INDENT# field_arguments [ 'to_field' ] = old_field . to_fields [ 0 ] #NEWLINE# #UNINDENT# if getattr ( old_field , 'db_column' , None ) : #NEWLINE# #INDENT# field_arguments [ 'db_column' ] = old_field . db_column #NEWLINE# #UNINDENT# field = FieldType ( old_field . rel . to , related_name = '+' , null = True , blank = True , primary_key = False , db_index = True , serialize = True , unique = False , on_delete = models . DO_NOTHING , ** field_arguments ) #NEWLINE# field . name = old_field . name #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# transform_field ( field ) #NEWLINE# #UNINDENT# fields [ FieldType . name ] = field #NEWLINE# #UNINDENT# return fields