#NEWLINE# def _collect_editable_booleans( self ) : #NEWLINE# #INDENT# '\n        Collect all fields marked as editable booleans. We do not\n        want the user to be able to edit arbitrary fields by crafting\n        an AJAX request by hand.\n        ' #NEWLINE# if hasattr ( self , '_ajax_editable_booleans' ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# self . _ajax_editable_booleans = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for field in self . list_display : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# item = getattr ( self . __class__ , field ) #NEWLINE# #UNINDENT# except ( AttributeError , TypeError ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# attr = getattr ( item , 'editable_boolean_field' , None ) #NEWLINE# if result_func : #NEWLINE# #INDENT# if hasattr ( item , 'editable_boolean_result' ) : #NEWLINE# #INDENT# result_func = item . editable_boolean_result #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# def _fn( attr ) : #NEWLINE# #INDENT# return ( lambda self , instance : [ ajax_editable_boolean_cell ( instance , attr ) ] ) #NEWLINE# #UNINDENT# result_func = _fn ( attr ) #NEWLINE# #UNINDENT# self . _ajax_editable_booleans [ attr ] = result_func