有一个diibleby标签。
因此,您可以执行以下操作(难看):
<table><tr>{% for field in form %} <td>{{ field }}</td> {% if forloop.last %} </tr> {% else %} {% if forloop.counter|divisibleby:"3" %} </tr><tr> {% endif %} {% endif %}{% endfor %}</table>另外,您可以为表单类提供一个
table_print返回html字符串(包装在中
mark_safe)的方法。



