#NEWLINE# def clean_values( apps , schema_editor ) : #NEWLINE# #INDENT# Observation = apps . get_model ( 'contributions' , 'Observation' ) #NEWLINE# NumericField = apps . get_model ( 'categories' , 'NumericField' ) #NEWLINE# LookupField = apps . get_model ( 'categories' , 'LookupField' ) #NEWLINE# MultipleLookupField = apps . get_model ( 'categories' , 'MultipleLookupField' ) #NEWLINE# for field in NumericField . objects . all ( ) : #NEWLINE# #INDENT# for observation in Observation . objects . filter ( category = field . category ) : #NEWLINE# #INDENT# if observation . properties : #NEWLINE# #INDENT# value = observation . properties . get ( field . key ) #NEWLINE# if value : #NEWLINE# #INDENT# observation . properties [ value . key ] = clean_number ( value ) #NEWLINE# observation . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for field in LookupField . objects . all ( ) : #NEWLINE# #INDENT# for observation in Observation . objects . filter ( category = field . category ) : #NEWLINE# #INDENT# if observation . properties : #NEWLINE# #INDENT# value = observation . properties . get ( field . key ) #NEWLINE# if value : #NEWLINE# #INDENT# observation . properties [ field . key ] = clean_int ( value ) #NEWLINE# observation . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for field in MultipleLookupField . objects . all ( ) : #NEWLINE# #INDENT# for observation in Observation . objects . filter ( category = field . category ) : #NEWLINE# #INDENT# if observation . properties : #NEWLINE# #INDENT# value = observation . properties . get ( field . key ) #NEWLINE# if value : #NEWLINE# #INDENT# observation . properties [ field . key ] = clean_list ( value ) #NEWLINE# observation . save ( )