How to change the column header of a django-tables2 table in the view.py?
08:09 22 Jan 2015

I'm using django-tables2 in my Django project and I would like to change dynamically the header of some columns according to a database query, which is done in view.py.

I know that in tables.py one can change the "verbose_name" attribute of each and every column but I would like to assign a template variable "{{ headerxy }}" for example so that it changes dynamically.

Or is there a way to change the "verbose_name" attribute in the view.py ?

Something like:

table.columns['column1'].header = some_data

Thanks

python django view header django-tables2