Django: How do I add arbitrary html attributes to input fields on a form?
Posted
by User
on Stack Overflow
See other posts from Stack Overflow
or by User
Published on 2010-05-25T04:27:46Z
Indexed on
2010/05/25
4:31 UTC
Read the original article
Hit count: 419
I have an input field that is rendered with a template like so:
<div class="field">
{{ form.city }}
</div>
Which is rendered as:
<div class="field">
<input id="id_city" type="text" name="city" maxlength="100" />
</div>
Now suppose I want to add an autocomplete="off" attribute to the input element that is rendered, how would I do that? Or onclick="xyz()" or class="my-special-css-class"?
© Stack Overflow or respective owner