views:

26

answers:

1

If there were field.errors in django, how to to add css class to {{ field }}, example at bottom

{% for field in form %}

{{ field }}

{% if field.errors %}{{ field.errors }}{% endif %}

{% endfor %}

Aiming for {{ field }} input type that would have "class=error" when ever there was an error

<input class="error">
+2  A: 
Mathias Nielsen