【发布时间】:2014-04-21 02:08:31
【问题描述】:
我在使用 django-tables2 和自定义模板渲染时遇到了这个问题。
当我添加另一列时出现问题,该列未在模型中指定,并弹出错误AttributeError: 'module' object has no attribute 'LinkColumn'。
当仅使用模型列时,表格和自定义渲染工作。
【问题讨论】:
-
你能添加一些代码吗?您在哪里以及如何添加
LinkColumn? -
感谢 Alex 的快速回答,但我想通了。我错误地从 django-tables2 导入了表,而不是像应该做的那样创建别名。我使用了这个:
from django-tables2 import tables当它应该是:import django-tables2 as tables感谢 dyve 和 bradleyayers 在这个线程中神秘地回答了这个问题github.com/bradleyayers/django-tables2/issues/79
标签: django python-2.7 django-tables2