#NEWLINE# def get_simple_instance( self , custom_values = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) : #NEWLINE# #INDENT# simple_xforms = XForm . objects . filter ( title = 'WaterSimple' ) #NEWLINE# if ( simple_xforms . count ( ) == 0 ) : #NEWLINE# #INDENT# xf = self . create_simple_xform ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# xf = simple_xforms [ 0 ] #NEWLINE# #UNINDENT# values = { #NEWLINE# #INDENT# 'device_id' : '12345' , #NEWLINE# 'start' : '2011-01-01T09:50:06.966' , #NEWLINE# 'end' : '2011-01-01T09:53:22.965' , #NEWLINE# 'geopoint' : '40.783594633609184 -73.96436698913574 300.0 4.0' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( 'start' in custom_values ) : #NEWLINE# #INDENT# st = custom_values [ 'start' ] #NEWLINE# custom_values [ 'start' ] = st . strftime ( XFORM_TIME_FORMAT ) #NEWLINE# values [ 'end' ] = ( st + ONE_HOUR ) . strftime ( XFORM_TIME_FORMAT ) #NEWLINE# #UNINDENT# if ( 'end' in custom_values ) : #NEWLINE# #INDENT# custom_values [ 'end' ] = custom_values [ 'end' ] . strftime ( XFORM_TIME_FORMAT ) #NEWLINE# #UNINDENT# values . update ( custom_values ) #NEWLINE# water_simple_survey = _load_simple_survey_object ( ) #NEWLINE# simple_survey = water_simple_survey . instantiate ( ) #NEWLINE# for ( k , v ) in values . items ( ) : #NEWLINE# #INDENT# simple_survey . answer ( name = k , value = v ) #NEWLINE# #UNINDENT# simple_survey . _id = xf . id_string #NEWLINE# instance_xml = simple_survey . to_xml ( ) #NEWLINE# return Instance ( xml = instance_xml )