How can I have two foreign keys to the same model in Django?

前端 未结 4 1885
时光说笑
时光说笑 2020-11-27 06:01

I want to have two foreign keys to the same model:

class Test(models.model):
    example1 = models.ForeignKey(Example)
    example2 = models.ForeignKey(Examp         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 06:34

    Just do what the error message tells you to do, and if you're unsure what that means, consult the documentation for related_name.

提交回复
热议问题