def result_headers(cl):
 ordering_field_columns = cl.get_ordering_field_columns()
 for (i, field_name) in enumerate(cl.list_display):
  (text, attr) = label_for_field(field_name, cl.model, model_admin=cl.model_admin, return_attr=True)
  if attr:
   if (field_name == u'action_checkbox'):
    (yield {u'text': text, u'class_attrib': mark_safe(u' class="action-checkbox-column"'), u'sortable': False})
    continue
   admin_order_field = getattr(attr, u'admin_order_field', None)
   if (not admin_order_field):
    (yield {u'text': text, u'class_attrib': format_html(u' class="column-{0}"', field_name), u'sortable': False})
    continue
  th_classes = [u'sortable', u'column-{0}'.format(field_name)]
  order_type = u''
  new_order_type = u'asc'
  sort_priority = 0
  sorted = False
  if (i in ordering_field_columns):
   sorted = True
   order_type = ordering_field_columns.get(i).lower()
   sort_priority = (list(ordering_field_columns).index(i) + 1)
   th_classes.append((u'sorted %sending' % order_type))
   new_order_type = {u'asc': u'desc', u'desc': u'asc'}[order_type]
  o_list_primary = []
  o_list_remove = []
  o_list_toggle = []
  make_qs_param = (lambda t, n: ((u'-' if (t == u'desc') else u'') + str(n)))
  for (j, ot) in ordering_field_columns.items():
   if (j == i):
    param = make_qs_param(new_order_type, j)
    o_list_primary.insert(0, param)
    o_list_toggle.append(param)
   else:
    param = make_qs_param(ot, j)
    o_list_primary.append(param)
    o_list_toggle.append(param)
    o_list_remove.append(param)
  if (i not in ordering_field_columns):
   o_list_primary.insert(0, make_qs_param(new_order_type, i))
  (yield {u'text': text, u'sortable': True, u'sorted': sorted, u'ascending': (order_type == u'asc'), u'sort_priority': sort_priority, u'url_primary': cl.get_query_string({ORDER_VAR: u'.'.join(o_list_primary)}), u'url_remove': cl.get_query_string({ORDER_VAR: u'.'.join(o_list_remove)}), u'url_toggle': cl.get_query_string({ORDER_VAR: u'.'.join(o_list_toggle)}), u'class_attrib': (format_html(u' class="{0}"', u' '.join(th_classes)) if th_classes else u'')})

def result_headers ( cl ) : ordering_field_columns = cl . get_ordering_field_columns ( ) for ( i , field_name ) in enumerate ( cl . list_display ) : ( text , attr ) = label_for_field ( field_name , cl . model , model_admin = cl . model_admin , return_attr = True ) if attr : if ( field_name == u'action_checkbox' ) : ( yield { u'text' : text , u'class_attrib' : mark_safe ( u' class="action-checkbox-column"' ) , u'sortable' : False } ) continue admin_order_field = getattr ( attr , u'admin_order_field' , None ) if ( not admin_order_field ) : ( yield { u'text' : text , u'class_attrib' : format_html ( u' class="column-{0}"' , field_name ) , u'sortable' : False } ) continue th_classes = [ u'sortable' , u'column-{0}' . format ( field_name ) ] order_type = u'' new_order_type = u'asc' sort_priority = 0 sorted = False if ( i in ordering_field_columns ) : sorted = True order_type = ordering_field_columns . get ( i ) . lower ( ) sort_priority = ( list ( ordering_field_columns ) . index ( i ) + 1 ) th_classes . append ( ( u'sorted %sending' % order_type ) ) new_order_type = { u'asc' : u'desc' , u'desc' : u'asc' } [ order_type ] o_list_primary = [ ] o_list_remove = [ ] o_list_toggle = [ ] make_qs_param = ( lambda t , n : ( ( u'-' if ( t == u'desc' ) else u'' ) + str ( n ) ) ) for ( j , ot ) in ordering_field_columns . items ( ) : if ( j == i ) : param = make_qs_param ( new_order_type , j ) o_list_primary . insert ( 0 , param ) o_list_toggle . append ( param ) else : param = make_qs_param ( ot , j ) o_list_primary . append ( param ) o_list_toggle . append ( param ) o_list_remove . append ( param ) if ( i not in ordering_field_columns ) : o_list_primary . insert ( 0 , make_qs_param ( new_order_type , i ) ) ( yield { u'text' : text , u'sortable' : True , u'sorted' : sorted , u'ascending' : ( order_type == u'asc' ) , u'sort_priority' : sort_priority , u'url_primary' : cl . get_query_string ( { ORDER_VAR : u'.' . join ( o_list_primary ) } ) , u'url_remove' : cl . get_query_string ( { ORDER_VAR : u'.' . join ( o_list_remove ) } ) , u'url_toggle' : cl . get_query_string ( { ORDER_VAR : u'.' . join ( o_list_toggle ) } ) , u'class_attrib' : ( format_html ( u' class="{0}"' , u' ' . join ( th_classes ) ) if th_classes else u'' ) } )
generates the list column headers .