#NEWLINE# def headers( self , data ) : #NEWLINE# #INDENT# column_headers = [ ] #NEWLINE# groupped_headers = [ list ( v ) for ( l , v ) in groupby ( sorted ( data . keys ( ) , key = ( lambda x : x [ 2 ] ) ) , ( lambda x : x [ 2 ] ) ) ] #NEWLINE# for domain in groupped_headers : #NEWLINE# #INDENT# groupped_practices = [ list ( v ) for ( l , v ) in groupby ( sorted ( domain , key = ( lambda x : x [ 3 ] ) ) , ( lambda x : x [ 3 ] ) ) ] #NEWLINE# domain_group = DataTablesColumnGroup ( self . group_name_fn ( domain [ 0 ] [ 2 ] ) ) #NEWLINE# for practice in groupped_practices : #NEWLINE# #INDENT# domain_group . add_column ( DataTablesColumn ( self . group_name_fn ( data [ 0 ] [ 3 ] ) ) ) #NEWLINE# #UNINDENT# column_headers . append ( domain_group ) #NEWLINE# #UNINDENT# column_headers = sorted ( column_headers , key = ( lambda x : x . html ) ) #NEWLINE# i = 1 #NEWLINE# for column in column_headers : #NEWLINE# #INDENT# for j in range ( 0 , len ( column . columns ) ) : #NEWLINE# #INDENT# column . columns [ j ] = DataTablesColumn ( ( 'Practice ' + i . __str__ ( ) ) , help_text = column . columns [ j ] . html ) #NEWLINE# i += 1 #NEWLINE# #UNINDENT# #UNINDENT# return column_headers