-
Notifications
You must be signed in to change notification settings - Fork 429
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
[Bug] sequence in combination with extra_columns does not show extra_columns #450
[Bug] sequence in combination with extra_columns does not show extra_columns #450
Comments
Interesting, thanks for reporting. Are you able to transform your example into a test case runnable in the test suite? |
I think the whole extra_columns attribute is untested in the test suite and needs testing. I'm not very good at writing tests, but I think a testcase that tests if extra_columns are actually added will catch this. |
Or is extra_columns not the preferred way to add extra columns in the view? |
Just to be sure, this is not correct syntax. |
@jieter I have updated the example, you are correct, I just typed in the minimal example to demonstrate the problem from my head. |
Failing test: def test_dynamically_add_column_with_sequence():
class MyTable(tables.Table):
name = tables.Column()
class Meta:
sequence = ('...', 'name')
assert list(MyTable(data, extra_columns=[
('country', tables.Column())
]).columns.columns.keys()) == ['country', 'name'] |
the |
@gabn88 just pushed a fix, please test branch
|
Thanks for the quick fix! I will test this now. |
It seems the bug is not solved with the latest release. I still get a table with only 'name'. The other fields added via 'extra_columns' are still omitted. |
That's correct, not released yet. That's why I asked to test with master.zip from github. |
I mean with the master, I'm sorry, it was a busy day ;) |
hmm, can you provide a minimal test case like I did above demonstrating what fails? |
ok, will do :) |
hmm, stupid question, but how do I include django_tables2 WITH tests? Because now there are no tests in my site-packages/django_tables2/? |
Download the zip and add a test in the tests directory? |
Ok, I cannot get the new code to work at all with my example. However the current release is working.
|
Quite hard to see why if you only include part of a stack trace. Can you:
|
If I have a table
a column:
and a view:
table = MyTable(extra_columns=('myfield3',Field3Column))
the table from the view will not contain Field3Column. However, by omitting the sequence on the Meta it does show the Field3.
The text was updated successfully, but these errors were encountered: