@register.filter
def with_class(field):
    class_name = field.field.widget.__class__.__name__.lower()
    class_name = class_converter.get(class_name, class_name)
    if "class" in field.field.widget.attrs:
        field.field.widget.attrs['class'] += " %s" % class_name
    else:
        field.field.widget.attrs['class'] = class_name

    field.field.widget.attrs['class'] += " form-control"
    return unicode(field)
dataset/ETHPy150Open amarandon/smeuhsocial/apps/smeuhoverride/templatetags/override_tags.py/with_class/original