0π
β
thanks for your suggestions β they helped! Here is what finally worked for me:
{% for field in form %}
{% if forloop.counter0|divisibleby:5 %}
<tr>
{% for field in form %}
{% if forloop.counter0 >= forloop.parentloop.counter0 and forloop.counter0 <= forloop.parentloop.counter0|add:4 %}
<th>{{ field.label_tag }}{{ field.errors }} </th>
{% endif %}
{% endfor %}
</tr>
<tr>
{% for field in form %}
{% if forloop.counter0 >= forloop.parentloop.counter0 and forloop.counter0 <= forloop.parentloop.counter0|add:4 %}
<td>{{ field }}</td>
{% endif %}
{% endfor %}
</tr>
{% endif %}
{% endfor %}
π€Shafique Jamal
1π
Iβm really not sure what you are looking for, but it sounds like this:
{% for field in form %}
<tr>
{% if forloop.counter0|divisibleby:5 %}
<th class="span4">{{ field.label_tag }}{{ field.errors }}</th>
{% else %}
<th>{{ field.label_tag }}{{ field.errors }}</th>
{% endif %}
</tr>
{% endfor%}
{% for field in form %}
<tr>
{% if forloop.counter0|divisibleby:5 %}
<td>{{ field|add_class:"span4" }}</td>
{% else %}
<td>{{ field }}</td>
</tr>
{% endfor %}
π€Burhan Khalid
- [Answer]-Adding in a custom checkbox to a django form
- [Answer]-Dc.js: Tooltip does not display
- [Answer]-Python string clean up: How can I remove the excess of newlines of a string in python?
- [Answer]-MultipleChoiceFileld in ModelForm will only submit when default option available but nothing is selected
0π
I dont like this code, but it was my first idea.
{% for field in form %}
{% if forloop.last %}
{{ forloop.counter }}
{% endif %}
{% enfor %}
π€Leandro
- [Answer]-How to handle form.non_field_errors and form.errors?
- [Answer]-Django detect errors while sending mail
- [Answer]-Failed to sen data to server angularjs
- [Answer]-Can you set a breakpoint and drop into interactive mode from command line in pycharm 3?
- [Answer]-Django Template β How to insert and place a value in select box, on default?
- [Answer]-Django: Can't load cyrillic font in font-face
- [Answer]-Django β Create Category Views doesn't create Column
Source:stackexchange.com