@register.filter
def attr(boundfield, attrval):
    """
    Given "attr:val" arg, set attr to val on the field's widget.

    If given arg has no colon, set it as a no-value attribute (only works with
    floppyforms widgets).

    """
    try:
        attr, val = attrval.split(":", 1)
    except __HOLE__:
        attr, val = attrval, True

    boundfield.field.widget.attrs[attr] = val
    return boundfield
dataset/ETHPy150Open mozilla/moztrap/moztrap/view/templatetags/mtforms.py/attr