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

Fix for #399 #400

Merged
merged 1 commit into from
Dec 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@
/example/.env
/report.pylint
.cache/
.python-version
.idea
6 changes: 6 additions & 0 deletions django_tables2/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,17 @@ def __new__(mcs, name, bases, attrs):

# Explicit columns override both parent and generated columns
base_columns.update(OrderedDict(cols))

# Apply any explicit exclude setting
for exclusion in opts.exclude:
if exclusion in base_columns:
base_columns.pop(exclusion)

# Remove any columns from our remainder, else columns from our parent class will remain
for attr_name in remainder:
if attr_name in base_columns:
base_columns.pop(attr_name)

# Reorder the columns based on explicit sequence
if opts.sequence:
opts.sequence.expand(base_columns.keys())
Expand Down
2 changes: 1 addition & 1 deletion example/requirements.pip
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
-e ..
django-debug-toolbar
django-debug-toolbar<1.6
7 changes: 7 additions & 0 deletions tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ class CityTable(GeoAreaTable, AddedMixin):
assert len(CityTable.base_columns) == 4
assert 'added' in CityTable.base_columns

# overwrite a column with a non-column
class MayorlessCityTable(CityTable):
mayor = None

assert len(MayorlessCityTable.base_columns) == 3



def test_metaclass_inheritance():
class Tweaker(type):
Expand Down