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

Allow computable attrs for <td> from table.attrs #457

Merged
merged 3 commits into from
Jun 22, 2017
Merged

Allow computable attrs for <td> from table.attrs #457

merged 3 commits into from
Jun 22, 2017

Conversation

jieter
Copy link
Owner

@jieter jieter commented Jun 21, 2017

It was already possible to use the attrs-argument like this:

class Table(tables.Table):
    class Meta:
        attrs = {
           'td': {'class': 'foo'}
        }

But it did not pass any relevant arguments to callables. This PR changes that and passes column and table keyword arguments if appropriate:

class Table(tables.Table):
    class Meta:
        attrs = {
           'td': {'data-name': lambda column: column.name}
        }

Fixes #451

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

Successfully merging this pull request may close these issues.

1 participant