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

Meta fields inheritance: doc and code disagree #846

Open
weber-s opened this issue May 24, 2022 · 0 comments
Open

Meta fields inheritance: doc and code disagree #846

weber-s opened this issue May 24, 2022 · 0 comments

Comments

@weber-s
Copy link
Contributor

weber-s commented May 24, 2022

In the doc it is stated that:

https://django-tables2.readthedocs.io/en/latest/pages/api-reference.html#Table.Meta

All attributes are overwritten if defined in the child’s class Meta, no merging is attempted.

However, in the code there is:

tables.py:40

        # If this class is subclassing other tables, add their fields as
        # well. Note that we loop over the bases in *reverse* - this is
        # necessary to preserve the correct order of columns.
        parent_columns = []
        for base in reversed(bases):
            if hasattr(base, "base_columns"):
                parent_columns = list(base.base_columns.items()) + parent_columns

        # Start with the parent columns
        base_columns = OrderedDict(parent_columns)

So, in fact, fields attribute is indeed merge between parent and child.

I don't know which behavior is wanted, but this confusion is... confusing 😃

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