1
這似乎與this question非常相似。當點擊鏈接按pass_count排序時,我得到:非查詢集數據排序
無法將關鍵字u'pass_count'解析爲字段。選項包括:建立,build_no
models.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
tables.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"}})
是否有辦法來解決此問題?