def form_for_fields(field_list):
 fields = SortedDictFromList([(f.name, f.formfield()) for f in field_list if f.editable])
 return type('FormForFields', (BaseForm,), {'base_fields': fields})

def form_for_fields ( field_list ) : fields = SortedDictFromList ( [ ( f . name , f . formfield ( ) ) for f in field_list if f . editable ] ) return type ( 'FormForFields' , ( BaseForm , ) , { 'base_fields' : fields } )
returns a form class for the given list of django database field instances .