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

self.base_columns not emptied on init #403

Closed
fkdeboer opened this issue Dec 30, 2016 · 2 comments · Fixed by Karaage-Cluster/karaage#306, mozilla/addons-server#5548, rlmv/doc-trips#90 or drummonds/bene#50

Comments

@fkdeboer
Copy link
Collaborator

fkdeboer commented Dec 30, 2016

Hi, I add some extra columns dynamically through the init (see code below), which works for me. However, when changing view and coming back, at first the columns are still there, while extra_columns is empty, so no the columns are not added.
This is caused by self.base_columns not being empty at init. Is this intended, or a bug/feature in tables2?
Or is this because of my code, and is there a neater/better way to add columns dynamically?
feedback welcome.

class FooTable(Table):
    Foo=Column()

    def __init__(self, *args, **kwargs):
        extra_columns = kwargs.pop('extra_columns', [])
        for column_name in extra_columns:
               self.base_columns[column_name] = Column()
        super(FooTable, self).__init__(*args, **kwargs)
@intiocean
Copy link
Contributor

intiocean commented Jan 4, 2017

This is the same issue as discussed in #70

@fkdeboer
Copy link
Collaborator Author

fkdeboer commented Jan 4, 2017

indeed!
sorry to have missed that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment