#NEWLINE# def migrate_old_comments( apps , schema_editor ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# from django.contrib.comments.models import Comment as OldComment #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# Comment = apps . get_model ( 'document_comments' , 'Comment' ) #NEWLINE# Document = apps . get_model ( 'documents' , 'Document' ) #NEWLINE# User = apps . get_model ( * settings . AUTH_USER_MODEL . split ( '.' ) ) #NEWLINE# for old_comment in OldComment . objects . all ( ) : #NEWLINE# #INDENT# comment = Comment ( document = Document . objects . get ( pk = old_comment . object_pk ) , user = User ( old_comment . user . pk ) , comment = old_comment . comment , submit_date = old_comment . submit_date ) #NEWLINE# comment . save ( )