def get_columns_dict(columns):
 columns_dict = {}
 for (idx, col) in enumerate(columns):
  col_dict = {}
  if isinstance(col, basestring):
   col = col.split(u':')
   if (len(col) > 1):
    if (u'/' in col[1]):
     (col_dict[u'fieldtype'], col_dict[u'options']) = col[1].split(u'/')
    else:
     col_dict[u'fieldtype'] = col[1]
   col_dict[u'fieldname'] = frappe.scrub(col[0])
  else:
   col_dict.update(col)
   if (u'fieldname' not in col_dict):
    col_dict[u'fieldname'] = frappe.scrub(col_dict[u'label'])
  columns_dict[idx] = col_dict
  columns_dict[col_dict[u'fieldname']] = col_dict
 return columns_dict

def get_columns_dict ( columns ) : columns_dict = { } for ( idx , col ) in enumerate ( columns ) : col_dict = { } if isinstance ( col , basestring ) : col = col . split ( u':' ) if ( len ( col ) > 1 ) : if ( u'/' in col [ 1 ] ) : ( col_dict [ u'fieldtype' ] , col_dict [ u'options' ] ) = col [ 1 ] . split ( u'/' ) else : col_dict [ u'fieldtype' ] = col [ 1 ] col_dict [ u'fieldname' ] = frappe . scrub ( col [ 0 ] ) else : col_dict . update ( col ) if ( u'fieldname' not in col_dict ) : col_dict [ u'fieldname' ] = frappe . scrub ( col_dict [ u'label' ] ) columns_dict [ idx ] = col_dict columns_dict [ col_dict [ u'fieldname' ] ] = col_dict return columns_dict
returns a dict with column docfield values as dict the keys for the dict are both idx and fieldname .