这两种方法是等价的。在
class X(object):
a = 1
我想知道什么是等效的:
class ObjectTable(tables.ModelTable):
id = tables.Column(sortable=False, visible=False)
societe = tables.Column(sortable=False, visible=False)
class Meta:
model = models.get_model('core', "Fournisseur")
我试过了但没用:
ObjectTable=type('ObjectTable',(tables.ModelTable,),dict(model=myModel))
ObjectTable=type('ObjectTable',(tables.ModelTable,),dict(meta.model=myModel))
ObjectTable=type('ObjectTable',(tables.ModelTable,),dict(meta=myModel))
谢谢。在
它与django示例中的值完全相同。你自己试试吧。在
您的所有示例都如您所说“不起作用”,因为(a)除了
meta
(b)不创建任何其他应拼写为Meta
的字段(c)Meta
的值应该是一个(旧样式)类。在解决方法如下:
在开始之前,我同意S.Lott的评论。你几乎肯定不想这么做。在
接下来是:
相关问题 更多 >
编程相关推荐