def flatten_fieldsets(fieldsets):
 field_names = []
 for (name, opts) in fieldsets:
  for field in opts[u'fields']:
   if (type(field) == tuple):
    field_names.extend(field)
   else:
    field_names.append(field)
 return field_names

def flatten_fieldsets ( fieldsets ) : field_names = [ ] for ( name , opts ) in fieldsets : for field in opts [ u'fields' ] : if ( type ( field ) == tuple ) : field_names . extend ( field ) else : field_names . append ( field ) return field_names
returns a list of field names from an admin fieldsets structure .