#NEWLINE# def test_complex_searchable_list( ) : #NEWLINE# #INDENT# ( app , db , admin ) = setup ( ) #NEWLINE# ( Model1 , Model2 ) = create_models ( db ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_searchable_list = [ 'model1.test1' ] ) #NEWLINE# admin . add_view ( view ) #NEWLINE# m1 = Model1 ( 'model1-test1-val' ) #NEWLINE# m2 = Model1 ( 'model1-test2-val' ) #NEWLINE# db . session . add ( m1 ) #NEWLINE# db . session . add ( m2 ) #NEWLINE# db . session . add ( Model2 ( 'model2-test1-val' , model1 = m1 ) ) #NEWLINE# db . session . add ( Model2 ( 'model2-test2-val' , model1 = m2 ) ) #NEWLINE# db . session . commit ( ) #NEWLINE# client = app . test_client ( ) #NEWLINE# rv = client . get ( '/admin/model2/?search=model1-test1' ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'model2-test1-val' in data ) ) #NEWLINE# ok_ ( ( 'model2-test2-val' not in data ) ) #NEWLINE# view2 = CustomModelView ( Model1 , db . session , column_searchable_list = [ Model2 . string_field ] ) #NEWLINE# admin . add_view ( Model2 ) #NEWLINE# rv = client . get ( '/admin/model1/?search=model2-test1' ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'model1-test1-val' in data ) ) #NEWLINE# ok_ ( ( 'model1-test2-val' not in data ) )