我有一个使用 django-tables2
定义的表:
class MyTable(tables.Table):
action = tables.Column()
class Meta:
model = User
fields = ['name', 'email']
def render_action(self, record):
return 'Foo'
但是 render_action
方法被忽略,取而代之的是为每一行打印一个 -- 。我错过了什么?
最佳答案
我终于解决了将 empty_values=()
添加到 action
列属性的问题。
关于python - django-tables2 中带有 render_* 方法的列不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42726490/