{% for name, value in field.field.widget.attrs.items %}
    {% if value is not False %}
        {{ name }}{% if value is not True %}="{{ value|stringformat:'s' }}" {% endif %}
    {% endif %}
{% endfor %}
