#NEWLINE# def test_column_filters( ) : #NEWLINE# #INDENT# ( app , db , admin ) = setup ( ) #NEWLINE# ( Model1 , Model2 ) = create_models ( db ) #NEWLINE# view = CustomModelView ( Model1 , db . session , column_filters = [ 'test1' ] ) #NEWLINE# admin . add_view ( view ) #NEWLINE# eq_ ( len ( view . _filters ) , 7 ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Test1' ] ] , [ ( 0 , 'equals' ) , ( 1 , 'not equal' ) , ( 2 , 'contains' ) , ( 3 , 'not contains' ) , ( 4 , 'empty' ) , ( 5 , 'in list' ) , ( 6 , 'not in list' ) ] ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_filters = [ 'model1' ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Model1 / Test1' ] ] , [ ( 0 , 'equals' ) , ( 1 , 'not equal' ) , ( 2 , 'contains' ) , ( 3 , 'not contains' ) , ( 4 , 'empty' ) , ( 5 , 'in list' ) , ( 6 , 'not in list' ) ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Model1 / Test2' ] ] , [ ( 7 , 'equals' ) , ( 8 , 'not equal' ) , ( 9 , 'contains' ) , ( 10 , 'not contains' ) , ( 11 , 'empty' ) , ( 12 , 'in list' ) , ( 13 , 'not in list' ) ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Model1 / Test3' ] ] , [ ( 14 , 'equals' ) , ( 15 , 'not equal' ) , ( 16 , 'contains' ) , ( 17 , 'not contains' ) , ( 18 , 'empty' ) , ( 19 , 'in list' ) , ( 20 , 'not in list' ) ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Model1 / Test4' ] ] , [ ( 21 , 'equals' ) , ( 22 , 'not equal' ) , ( 23 , 'contains' ) , ( 24 , 'not contains' ) , ( 25 , 'empty' ) , ( 26 , 'in list' ) , ( 27 , 'not in list' ) ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Model1 / Bool Field' ] ] , [ ( 28 , 'equals' ) , ( 29 , 'not equal' ) ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Model1 / Enum Field' ] ] , [ ( 30 , 'equals' ) , ( 31 , 'not equal' ) , ( 32 , 'empty' ) , ( 33 , 'in list' ) , ( 34 , 'not in list' ) ] ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_filters = [ 'model1.bool_field' ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Model1 / Bool Field' ] ] , [ ( 0 , 'equals' ) , ( 1 , 'not equal' ) ] ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_filters = [ 'model1.bool_field' , 'string_field' ] , column_labels = { #NEWLINE# #INDENT# 'model1.bool_field' : 'Test Filter #1' , #NEWLINE# 'string_field' : 'Test Filter #2' , #NEWLINE# #UNINDENT# } ) #NEWLINE# eq_ ( list ( view . _filter_groups . keys ( ) ) , [ 'Test Filter #1' , 'Test Filter #2' ] ) #NEWLINE# fill_db ( db , Model1 , Model2 ) #NEWLINE# client = app . test_client ( ) #NEWLINE# rv = client . get ( '/admin/model1/?flt0_0=test1_val_1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/model1/?flt0_6=test1_val_1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' in data ) ) #NEWLINE# view = CustomModelView ( Model1 , db . session , column_filters = [ 'test1' ] , endpoint = '_strings' ) #NEWLINE# admin . add_view ( view ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Test1' ] ] , [ ( 0 , 'equals' ) , ( 1 , 'not equal' ) , ( 2 , 'contains' ) , ( 3 , 'not contains' ) , ( 4 , 'empty' ) , ( 5 , 'in list' ) , ( 6 , 'not in list' ) ] ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_0=test1_val_1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_1=test1_val_1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_2=test1_val_1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_3=test1_val_1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_4=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'empty_obj' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_4=0' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'empty_obj' not in data ) ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_5=test1_val_1%2Ctest1_val_2' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test1_val_4' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_strings/?flt0_6=test1_val_1%2Ctest1_val_2' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' not in data ) ) #NEWLINE# ok_ ( ( 'test1_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_4' in data ) ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_filters = [ 'int_field' ] ) #NEWLINE# admin . add_view ( view ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Int Field' ] ] , [ ( 0 , 'equals' ) , ( 1 , 'not equal' ) , ( 2 , 'greater than' ) , ( 3 , 'smaller than' ) , ( 4 , 'empty' ) , ( 5 , 'in list' ) , ( 6 , 'not in list' ) ] ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_0=5000' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_0=badval' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Invalid Filter Value' in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_1=5000' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_2=6000' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_3=6000' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_4=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_4=0' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_5=5000%2C9000' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_5=5000%2Cbadval' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Invalid Filter Value' in data ) ) #NEWLINE# rv = client . get ( '/admin/model2/?flt0_6=5000%2C9000' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_filters = [ 'float_field' ] , endpoint = '_float' ) #NEWLINE# admin . add_view ( view ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Float Field' ] ] , [ ( 0 , 'equals' ) , ( 1 , 'not equal' ) , ( 2 , 'greater than' ) , ( 3 , 'smaller than' ) , ( 4 , 'empty' ) , ( 5 , 'in list' ) , ( 6 , 'not in list' ) ] ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_0=25.9' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in Model1 ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_0=badval' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Invalid Filter Value' in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_1=25.9' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_2=60.5' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_3=60.5' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_4=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_4=0' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_5=25.9%2C75.5' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_5=25.9%2Cbadval' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Invalid Filter Value' in data ) ) #NEWLINE# rv = client . get ( '/admin/_float/?flt0_6=25.9%2C75.5' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# view = CustomModelView ( Model2 , db . session , endpoint = '_model2' , column_filters = [ 'model1.bool_field' ] , column_list = [ 'string_field' , 'model1.id' , 'model1.bool_field' ] ) #NEWLINE# admin . add_view ( view ) #NEWLINE# rv = client . get ( '/admin/_model2/?flt1_0=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test2_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test2_val_2' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_3' not in data ) ) #NEWLINE# ok_ ( ( 'test2_val_4' not in data ) ) #NEWLINE# view = CustomModelView ( Model1 , db . session , column_filters = [ 'test1' ] , endpoint = '_model3' , named_filter_urls = True ) #NEWLINE# admin . add_view ( view ) #NEWLINE# rv = client . get ( '/admin/_model3/?flt1_test1_equals=test1_val_1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' not in data ) ) #NEWLINE# view = CustomModelView ( Model1 , db . session , column_filters = [ 'date_field' , 'datetime_field' , 'time_field' ] , endpoint = '_datetime' ) #NEWLINE# admin . add_view ( view ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Date Field' ] ] , [ ( 0 , 'equals' ) , ( 1 , 'not equal' ) , ( 2 , 'greater than' ) , ( 3 , 'smaller than' ) , ( 4 , 'between' ) , ( 5 , 'not between' ) , ( 6 , 'empty' ) ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Datetime Field' ] ] , [ ( 7 , 'equals' ) , ( 8 , 'not equal' ) , ( 9 , 'greater than' ) , ( 10 , 'smaller than' ) , ( 11 , 'between' ) , ( 12 , 'not between' ) , ( 13 , 'empty' ) ] ) #NEWLINE# eq_ ( [ ( f [ 'index' ] , f [ 'operation' ] ) for f in view . _filter_groups [ 'Time Field' ] ] , [ ( 14 , 'equals' ) , ( 15 , 'not equal' ) , ( 16 , 'greater than' ) , ( 17 , 'smaller than' ) , ( 18 , 'between' ) , ( 19 , 'not between' ) , ( 20 , 'empty' ) ] ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_0=2014-11-17' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'date_obj1' in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_1=2014-11-17' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'date_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_2=2014-11-16' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'date_obj1' in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_3=2014-11-16' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'date_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_4=2014-11-13+to+2014-11-20' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'date_obj1' in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_5=2014-11-13+to+2014-11-20' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'date_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_6=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'date_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_6=0' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'date_obj1' in data ) ) #NEWLINE# ok_ ( ( 'date_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_7=2014-04-03+01%3A09%3A00' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'datetime_obj1' in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_8=2014-04-03+01%3A09%3A00' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'datetime_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_9=2014-04-03+01%3A08%3A00' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'datetime_obj1' in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_10=2014-04-03+01%3A08%3A00' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'datetime_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_11=2014-04-02+00%3A00%3A00+to+2014-11-20+23%3A59%3A59' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'datetime_obj1' in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_12=2014-04-02+00%3A00%3A00+to+2014-11-20+23%3A59%3A59' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'datetime_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_13=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_13=0' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj1' in data ) ) #NEWLINE# ok_ ( ( 'datetime_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_14=11%3A10%3A09' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'timeonly_obj1' in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_15=11%3A10%3A09' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'timeonly_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_16=11%3A09%3A09' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'timeonly_obj1' in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_17=11%3A09%3A09' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'timeonly_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_18=10%3A40%3A00+to+11%3A50%3A59' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'timeonly_obj1' in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_19=10%3A40%3A00+to+11%3A50%3A59' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'timeonly_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_20=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_datetime/?flt0_20=0' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj1' in data ) ) #NEWLINE# ok_ ( ( 'timeonly_obj2' in data ) ) #NEWLINE# view = CustomModelView ( Model1 , db . session , column_filters = [ 'enum_field' ] , endpoint = '_enumfield' ) #NEWLINE# admin . add_view ( view ) #NEWLINE# rv = client . get ( '/admin/_enumfield/?flt0_0=model1_v1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'enum_obj1' in data ) ) #NEWLINE# ok_ ( ( 'enum_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_enumfield/?flt0_1=model1_v1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'enum_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'enum_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_enumfield/?flt0_2=1' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'enum_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'enum_obj2' not in data ) ) #NEWLINE# rv = client . get ( '/admin/_enumfield/?flt0_2=0' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'enum_obj1' in data ) ) #NEWLINE# ok_ ( ( 'enum_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_enumfield/?flt0_3=model1_v1%2Cmodel1_v2' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' not in data ) ) #NEWLINE# ok_ ( ( 'enum_obj1' in data ) ) #NEWLINE# ok_ ( ( 'enum_obj2' in data ) ) #NEWLINE# rv = client . get ( '/admin/_enumfield/?flt0_4=model1_v1%2Cmodel1_v2' ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'enum_obj1' not in data ) ) #NEWLINE# ok_ ( ( 'enum_obj2' not in data ) ) #NEWLINE# view = CustomModelView ( Model2 , db . session , column_filters = [ filters . FilterEqual ( Model1 . test1 , 'Test1' ) ] , endpoint = '_relation_test' ) #NEWLINE# admin . add_view ( view ) #NEWLINE# rv = client . get ( '/admin/_relation_test/?flt1_0=test1_val_1' ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'test1_val_1' in data ) ) #NEWLINE# ok_ ( ( 'test1_val_2' not in data ) )