Skip to content

More meta attributes #964

Open
Open
@CleitonDeLima

Description

@CleitonDeLima

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions