treeeditor/admin.py
def _collect_editable_booleans(self):
        """
        Collect all fields marked as editable booleans. We do not
        want the user to be able to edit arbitrary fields by crafting
        an AJAX request by hand.
        """
        if hasattr(self, '_ajax_editable_booleans'):
            return

        self._ajax_editable_booleans = {}

        for field in self.list_display:
            # The ajax_editable_boolean return value has to be assigned
            # to the ModelAdmin class
            item = getattr(self.__class__, field, None)
            if not item:
                continue

            attr = getattr(item, 'editable_boolean_field', None)
            if attr:
                def _fn(self, instance):
                    return [ajax_editable_boolean_cell(instance, _fn.attr)]

                _fn.attr = attr
                result_func = getattr(item, 'editable_boolean_result', _fn)
                self._ajax_editable_booleans[attr] = result_func
def _collect_editable_booleans(self):
        if hasattr(self, '_ajax_editable_booleans'):
            return

        self._ajax_editable_booleans = {}

        for field in self.list_display:
            # The ajax_editable_boolean return value has to be assigned
            # to the ModelAdmin class
            item = getattr(self.__class__, field, None)
            if not item:
                continue

            attr = getattr(item, 'editable_boolean_field', None)
            if attr:
                def _fn(self, instance):
                    return [ajax_editable_boolean_cell(instance, _fn.attr)]

                _fn.attr = attr
                result_func = getattr(item, 'editable_boolean_result', _fn)
                self._ajax_editable_booleans[attr] = result_func
def _collect_editable_booleans ( self ) : if hasattr ( self , '_ajax_editable_booleans' ) : return self . _ajax_editable_booleans = { } for field in self . list_display : # The ajax_editable_boolean return value has to be assigned # to the ModelAdmin class item = getattr ( self . __class__ , field , None ) if not item : continue attr = getattr ( item , 'editable_boolean_field' , None ) if attr : def _fn ( self , instance ) : return [ ajax_editable_boolean_cell ( instance , _fn . attr ) ] _fn . attr = attr result_func = getattr ( item , 'editable_boolean_result' , _fn ) self . _ajax_editable_booleans [ attr ] = result_func
Collect all fields marked as editable booleans. We do not
        want the user to be able to edit arbitrary fields by crafting
        an AJAX request by hand.
Collect all fields marked as editable booleans . We do not want the user to be able to edit arbitrary fields by crafting an AJAX request by hand .