{% if "class" not in widget.attrs and widget.type != "checkbox" and widget.type != "radio" %} class="form-control"{% endif %}{% for name, value in widget.attrs.items %}{% if value is not False %} {{ name }}{% if value is not True %}="{{ value }}{% if name == "class" and "form-control" not in value and widget.type != "checkbox" and widget.type != "radio" %} form-control{% endif %}"{% endif %}{% endif %}{% endfor %}