django: form.fields not iterating through instance fields

后端 未结 3 1168
梦如初夏
梦如初夏 2020-12-10 09:00

I am trying to iterate through form.fields in a template and for:

{% for field in form.fields %}
   {{ field }}, 
{% endfor %}

I am getting

3条回答
  •  渐次进展
    2020-12-10 09:26

    The field you get are of django.forms.Field instances. To get the html view from it, you can use the widget function. {{ field.widget }}

提交回复
热议问题