I have a django-tables2 Table with many columns. Hence, I don't want to specify each column in the Table class separately, but just set the Model correspondingly.
Now, I'd like to change the properties of some columns that I can identify via their name. I'd like to do something like:
table = MyTable(my_queryset)
for col in table.columns.items():
col_name = col[0]
if col_name.endswith('some_suffix'):
table.columns[col_name].attrs['td'].update({'align': 'right'})
... which was supposed to change all columns whose name end with 'some_suffix'
such that the values are aligned right.
The problem, however, seems to be that table.columns[col_name]
is a BoundColumn
whose properties apparently can't be altered.
Does anyone know a quick fix for this problem ("make selected columns right aligned")?
Thank you, Philip