#NEWLINE# def test_filter_building( self ) : #NEWLINE# #INDENT# class PostAdminSimple ( djadmin2 . ModelAdmin2 ) : #NEWLINE# #INDENT# list_filter = [ 'published' ] #NEWLINE# #UNINDENT# class PostAdminWithFilterInstances ( djadmin2 . ModelAdmin2 ) : #NEWLINE# #INDENT# list_filter = [ django_filters . BooleanFilter ( name = 'published' ) ] #NEWLINE# #UNINDENT# class FS ( django_filters . FilterSet ) : #NEWLINE# #INDENT# class Meta ( ) : #NEWLINE# #INDENT# model = Post #NEWLINE# fields = [ 'published' ] #NEWLINE# #UNINDENT# #UNINDENT# class PostAdminWithFilterSetInst ( djadmin2 . ModelAdmin2 ) : #NEWLINE# #INDENT# list_filter = FS #NEWLINE# #UNINDENT# Post . objects . create ( title = 'post_1_title' , body = 'body' ) #NEWLINE# Post . objects . create ( title = 'post_2_title' , body = 'another body' ) #NEWLINE# request = self . rf . get ( reverse ( 'admin2:dashboard' ) ) #NEWLINE# list_filter_inst = djadmin2_filters . build_list_filter ( request , PostAdminSimple , Post . objects . all ( ) ) #NEWLINE# self . assertTrue ( issubclass ( list_filter_inst . __class__ , django_filters . FilterSet ) ) #NEWLINE# self . assertEqual ( list_filter_inst . filters [ 'published' ] . widget , djadmin2_filters . NullBooleanLinksWidget ) #NEWLINE# list_filter_inst = djadmin2_filters . build_list_filter ( request , PostAdminWithFilterInstances , Post . objects . all ( ) ) #NEWLINE# self . assertNotEqual ( list_filter_inst . filters [ 'published' ] . widget , djadmin2_filters . NullBooleanLinksWidget ) #NEWLINE# list_filter_inst = djadmin2_filters . build_list_filter ( self , PostAdminWithFilterSetInst , Post . objects . all ( ) ) #NEWLINE# self . assertTrue ( isinstance ( list_filter_inst , FS ) )