This is assuming that columns is a list containing Strings, each String is representing one of the object o's variable.
<tbody>
{% for o in objects %}
<tr>
{% for col in columns %}
<td>{{ o.col }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
Example:
class Dog(models.Model):
name = models.CharField()
age = models.IntegerField()
is_dead = models.BooleanField()
columns = ('name', 'age')
I cannot explicitly enter the object's variable name and must pass it as another list because I am trying to make a 'generic' template. Also, not all variables must be shown to the users.