假设我有以下型号:计数内多对多领域的Django
class Analysis(Model):
experts = ManyToManyField(Expert,
related_name='analysis',
through='AnalysisExpert')
class AnalysisExpert(Model):
analysis = ForeignKey(Analysis)
expert = ForeignKey(Expert
questions = ManyToManyField(Question, through='ExpertQuestion')
class ExpertQuestion(Model):
expert = ForeignKey(AnalysisExpert, related_name="expert_comparisons")
question = ForeignKey('Question')
它看起来像我有嵌套ManyToManyField。分析 - >专家 - >问题
什么是计算特定分析问题数量的最有效方法?
是否缺少在您的示例代码中的'Expert'模型,还是你不小心参考'Expert'你'Analysis'模式? – Hybrid
我使用它,但它不包含有关此问题的重要信息。用户也可以使用。 –