假設我有以下型號:計數內多對多領域的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
我使用它,但它不包含有關此問題的重要信息。用戶也可以使用。 –