Django: For Loop to Iterate Form Fields

前端 未结 4 1004
半阙折子戏
半阙折子戏 2021-02-07 10:09

I don\'t want to use django\'s built in form generation, seeking to specify each field in my template in order to customize the html output.

How do I iterate over a ser

4条回答
  •  别那么骄傲
    2021-02-07 10:50

    Well this would clearly not work:

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

    but this will:

    {% for field in form %}
        {{ field }}
    {% endfor %}
    

提交回复
热议问题