Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More meta attributes #964

Open
CleitonDeLima opened this issue Oct 7, 2024 · 0 comments
Open

More meta attributes #964

CleitonDeLima opened this issue Oct 7, 2024 · 0 comments

Comments

@CleitonDeLima
Copy link

CleitonDeLima commented Oct 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant