#NEWLINE# def get_extra_fields( self , model , fields ) : #NEWLINE# #INDENT# 'Return dict of extra fields added to the historical record model' #NEWLINE# user_model = getattr ( settings , 'AUTH_USER_MODEL' , 'auth.User' ) #NEWLINE# @ models . permalink #NEWLINE# def revert_url( self ) : #NEWLINE# #INDENT# 'URL for this change in the default admin site.' #NEWLINE# opts = model . _meta #NEWLINE# ( app_label , model_name ) = ( opts . app_label , opts . model_name ) #NEWLINE# return ( ( '%s:%s_%s_simple_history' % ( admin . site . name , app_label , model_name ) ) , [ getattr ( self , opts . pk . attname ) , self . history_id ] ) #NEWLINE# #UNINDENT# def get_instance( self ) : #NEWLINE# #INDENT# return model ( ** { field . attname : getattr ( self , field . attname ) for field in fields . values ( ) } ) #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'history_id' : models . AutoField ( primary_key = True ) , #NEWLINE# 'history_date' : models . DateTimeField ( ) , #NEWLINE# 'history_user' : models . ForeignKey ( user_model , null = True , related_name = self . user_related_name , on_delete = models . SET_NULL ) , #NEWLINE# 'history_type' : models . CharField ( max_length = 1 , choices = ( ( '+' , 'Created' ) , ( '~' , 'Changed' ) , ( '-' , 'Deleted' ) ) ) , #NEWLINE# 'history_object' : HistoricalObjectDescriptor ( model ) , #NEWLINE# 'instance' : property ( get_instance ) , #NEWLINE# 'instance_type' : model , #NEWLINE# 'revert_url' : fields , #NEWLINE# '__str__' : ( lambda self : ( '%s as of %s' % ( self . history_object , self . history_date ) ) ) , #NEWLINE# #UNINDENT# }