[英]Column with render_* method in django-tables2 not working
I have a table defined like this using django-tables2
: 我有一个使用
django-tables2
这样定义的表:
class MyTable(tables.Table):
action = tables.Column()
class Meta:
model = User
fields = ['name', 'email']
def render_action(self, record):
return 'Foo'
But the render_action
method is ignored and a -- is printed for every row instead. 但是
render_action
方法将被忽略,而是为每行打印一个-。 What am I missing? 我想念什么?
最后,我解决了将empty_values=()
添加到action
列属性的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.