@register.filter
def field_attrs(field_inst, **kwargs):
    for k, v in kwargs.items():
        if v is not None:
            field_inst.field.widget.attrs[k] = v
        else:
            try:
                del field_inst.field.widget.attrs[k]
            except KeyError:
                pass
    return field_inst
Generate SQL to transform an existing table
dataset/ETHPy150Open jbalogh/jingo/jingo/helpers.py/field_attrs--crossover with--dataset/ETHPy150Open perseas/Pyrseas/pyrseas/dbobject/foreign.py/ForeignTable.diff_map