示例模型Author
并Book
通过 M2M 链接。我找到了一种缓存关系的方法,但这并没有真正帮助,因为我需要在提要items
中显示一些信息:Author
Book
def item_title(self, item):
return f"{item.author_set.first().name} released {item.title}"
有什么办法可以在这里缓存 M2M 关系吗?
示例模型Author
并Book
通过 M2M 链接。我找到了一种缓存关系的方法,但这并没有真正帮助,因为我需要在提要items
中显示一些信息:Author
Book
def item_title(self, item):
return f"{item.author_set.first().name} released {item.title}"
有什么办法可以在这里缓存 M2M 关系吗?