treeeditor/admin.py
def ajax_editable_boolean_cell(item, attr, text='', override=None):
    """
    Generate a html snippet for showing a boolean value on the admin page.
    Item is an object, attr is the attribute name we should display. Text
    is an optional explanatory text to be included in the output.

    This function will emit code to produce a checkbox input with its state
    corresponding to the item.attr attribute if no override value is passed.
    This input is wired to run a JS ajax updater to toggle the value.

    If override is passed in, ignores the attr attribute and returns a
    static image for the override boolean with no user interaction possible
    (useful for "disabled and you can't change it" situations).
    """
    if text:
        text = '&nbsp;(%s)' % unicode(text)

    if override is not None:
        a = [django_boolean_icon(override, text), text]
    else:
        value = getattr(item, attr)
        a = [
            '<input type="checkbox"',
            value and ' checked="checked"' or '',
            ' onclick="return inplace_toggle_boolean(%d, \'%s\')";' % (item.id, attr),
            ' />',
            text,
        ]

    a.insert(0, '<div id="wrap_%s_%d">' % ( attr, item.id ))
    a.append('</div>')
    return unicode(''.join(a))
def ajax_editable_boolean_cell(item, attr, text='', override=None):
    if text:
        text = '&nbsp;(%s)' % unicode(text)

    if override is not None:
        a = [django_boolean_icon(override, text), text]
    else:
        value = getattr(item, attr)
        a = [
            '<input type="checkbox"',
            value and ' checked="checked"' or '',
            ' onclick="return inplace_toggle_boolean(%d, \'%s\')";' % (item.id, attr),
            ' />',
            text,
        ]

    a.insert(0, '<div id="wrap_%s_%d">' % ( attr, item.id ))
    a.append('</div>')
    return unicode(''.join(a))
def ajax_editable_boolean_cell ( item , attr , text = '' , override = None ) : if text : text = '&nbsp;(%s)' % unicode ( text ) if override is not None : a = [ django_boolean_icon ( override , text ) , text ] else : value = getattr ( item , attr ) a = [ '<input type="checkbox"' , value and ' checked="checked"' or '' , ' onclick="return inplace_toggle_boolean(%d, \'%s\')";' % ( item . id , attr ) , ' />' , text , ] a . insert ( 0 , '<div id="wrap_%s_%d">' % ( attr , item . id ) ) a . append ( '</div>' ) return unicode ( '' . join ( a ) )
Generate a html snippet for showing a boolean value on the admin page.
    Item is an object, attr is the attribute name we should display. Text
    is an optional explanatory text to be included in the output.

    This function will emit code to produce a checkbox input with its state
    corresponding to the item.attr attribute if no override value is passed.
    This input is wired to run a JS ajax updater to toggle the value.

    If override is passed in, ignores the attr attribute and returns a
    static image for the override boolean with no user interaction possible
    (useful for "disabled and you can't change it" situations).
Generate a html snippet for showing a boolean value on the admin page . Item is an object attr is the attribute name we should display . Text is an optional explanatory text to be included in the output .