I use my code to populate table : i have two record in counties cell and districts cell here is my code:
<table>
<tr>
<th>town</th>
<th>counties</th>
<th>districts</th>
<th>number doctor</th>
</tr>
{% for item in locality %}
<tr>
<td>{{ item.name }}</td>
<td>
{% for list in item.regions %}
{{ list.county}}
{% endfor %}
</td>
<td>
{% for list in item.regions %}
{{ list.code}}
{% endfor %}
</td>
<td>{{ item.regions|default([])|length }}</td>
</tr>
{% endfor %}
</table>
here is my table:
+--------+---------+----------+---------------+
| town |counties |districts | number doctor |
+--------+---------+----------+---------------+
| Adan | Afla | avo | |
| | kent | joly | 2 |
+--------+---------+----------+---------------+
however, I would like the table display to become :
+----------+---------+----------+---------------+
| town |counties |districts | number doctor |
+----------+---------+----------+---------------+
| Adan | Afla | avo | 2 |
+----------+---------+----------+---------------+
| Adan | kent | joly | 2 |
+----------+---------+----------+---------------+
How resolve this issue ?
NB: excuse my english,
thank you in advance
You just need to place your
for-loops different to read out your data, e.g.demo