我有两个模型:
class Hi(models.Model):
name = models.CharField(max_length=2)
class Hello(models.Model):
name = models.CharField(max_length=50)
his = models.ManyToManyField(Hi)
我正在尝试渲染Hello
模型。因此我有tables.py
这样的:
class HelloTable(tables.Table):
his = models.ColoumnField()
def render_his(self, value):
hi = []
for i in value.his.all():
hi.append(i)
return (',').join(hi)
#And the metas
我明白了ManyToMany has no attribute his
。怎么了?