So, I am creating a small app where I need to show an HTML table from the database entries. So I am using Django and the best solution for it was Django_tables2. And for the default setting, where all the fields from the model are being displayed it works ok. But I needed to add another column for a button and that's when I ran into a problem. I cannot add/delete a column or anything in the table. The changes I make in the Table class are rejected and the default settings are being still used.
I tried removing the template or the model from the View class, but nothing worked. I tried editing the Table class again, but nothing. I tried switching the View class from SingleTableView to SingleMixinView, but that just breaks it even more.
This is my Table class:
class InsertTable(tables.Table):
class Meta:
model = Insert
template_name = "list.html"
fields = ['id', 'name', 'phone', 'description', 'date', 'done', 'edit']
edit = tables.TemplateColumn(template_name="edit.html", verbose_name="edit", orderable=False)
This is my view class:
class List(SingleTableView):
model = Insert
table_class = InsertTable
template_name = "list.html"