Django circular model reference

前端 未结 8 1335
长发绾君心
长发绾君心 2020-11-29 07:42

I\'m starting to work on a small soccer league management website (mostly for learning purposes) and can\'t wrap my mind around a Django models relationship. For simplicity,

8条回答
  •  悲&欢浪女
    2020-11-29 08:23

    as you can see in the docs, for exactly this reason it is possible to specify the foreign model as a string.

    team = models.ForeignKey('Team')
    

提交回复
热议问题