Hi,
I have this problem which is probably right in front of my eyes but I
just cannot get it. Maybe someone can point me in the right direction:
I am trying to iterate through form.fields in a template.
The form is rather simple:
class ProductForm(forms.Form):
name = forms.CharField(max_length=200)
description = forms.CharField(max_length=200)
url = forms.URLField('Product URL Page', verify_exists=True,
required=False)
Iteration in template (standard):
{% for field in form.fields %}
<div class="fieldWrapper">
{{ field.errors }}
{{ field.label_tag }}: {{ field }}
</div>
{% endfor %}
The result of this code is EMPTY text.
However, the following code which reference specific fields:
{{ form.name.label_tag}}: {{
form.name }}
(and every other field I reference) renders the expected html without
any issue.
Any hints why this is happening?
Thanks, Yaniv