4👍
You have to pass an empty_values=()
keyword argument to the column, to quote the docs:
render methods are only called if the value for a cell is determined to be not an empty value. When a value is in
Column.empty_values
, a default value is rendered instead (both Column.render andTable.render_FOO
are skipped).
In your case, the ‘value’ for your non-existing column is None
, so if that value is in empty_values
, the default value (-
by default is rendered).
So in code, it could look like this:
class TaskTable(tables.Table):
foo = tables.Column(empty_values=())
def render_foo(self):
raise Exception()
class Meta:
model = Task
Source:stackexchange.com