jieter/django-tables2

More meta attributes

Opened this issue · 0 comments

We have some Meta attributes in the ModelForm that override the Form fields, for example, labels, help_texts, widgets, field_classes, etc.

To change some things in the column you need to overwrite the column:

class PersonTable(tables.Table):
    name = CustomColumn("Full name")
    age = tables.Column("Level")

    class Meta:
        model = Person
        fields = ["name", "age"]

We could do something similar in ModelForm.Meta for django-tables, for example:

class PersonTable(tables.Table):
    class Meta:
        model = Person
        fields = ["name", "age"]
        verbose_names = {
            "name": "Full name",
            "age": "Level",
        }
        column_classes = {
            "name": CustomColumn,
        }

This would help to write more dynamic tables.