这似乎与这个问题非常相似。单击按 pass_count 排序的链接时,我得到:
无法将关键字 u'pass_count' 解析为字段。选项有:build、build_no
模型.py:
class Run(DashboardBaseModel):
class Meta:
db_table = 'runs'
build_no = models.CharField(max_length=200, db_index = True)
release = models.CharField(max_length=200, db_index = True)
extra_fields = [
'pass_count',
]
@property
def pass_count(self):
passes = 0
for build in self.build_set.all():
passes += build.pass_count
return passes
表.py:
class CombineTable(tables.Table):
build_no = tables.LinkColumn('run', args=[A('release'), A('id')], verbose_name="Build")
pass_count = tables.Column(verbose_name="Passed", attrs={"td": {"class": "num"}, "th": {"class": "num"}})
有没有办法解决这个问题?