I have a python list that looks like this example:
[[' 1', ' 200', ' 30', ' item a'], [' 1', ' 500', ' 20', ' item b']]
This is then passed through to the template in django.
I am trying to generate a table using this data:
Each internal bracket (there are 2 in this example: [' 1', ' 200', ' 30', ' item a'] and [' 1', ' 500', ' 20', ' item b'] ) need to be in a new line in the table. So for this example, there would be 2 rows.
Each field within the internal brackets has to go in a new column in the table.. So this table will have 4 columns and 2 rows.
The basic template tag you need is the
fortag:I also use an
iftag so you don’t end up with an empty set oftabletags if there are no rows in the list.