29👍
✅
https://docs.djangoproject.com/en/dev/topics/forms/#s-looping-over-the-form-s-fields
Shows you can do
{{ FIELD.label_tag }}
Should render something like
<label for="id_fieldName">Fieldlabel:</label>
0👍
You can also do
class SomeForm(forms.Form):
foo = forms.ChoiceField(label='Some Foo', ...)
bar = forms.BooleanField(label='Some Bar', ...)
You can render form like:
<div class="col-12">
<div class="mb-3">
{{ form.foo.label }}
{{ form.foo}}
</div>
</div>
- [Django]-Django Form File Field disappears on form error
- [Django]-Images from ImageField in Django don't load in template
- [Django]-Get list item dynamically in django templates
Source:stackexchange.com