1👍
I bet your form field ad_interest
is a CharField
, so by doing {{ form.ad_interest }}
, django is already using the default widget for CharField
, that’s why without doing anything in your first case you’ve already got a <input .....>
html.
However, if you wrap the default widget into another layer of <input...>
, the html could obviously show as above. Essicially you were having following html, which is invalid:
<input type="text" class="..." value="<input...>" >
You would see the default widget html by using barely {{ form.ad_interest }}
and also, your field renders by itself correctly, right? 🙂
See django doc widget for TextInput
.
Source:stackexchange.com