Difference between ManyToOneRel and ForeignKey?

前端 未结 2 1564
隐瞒了意图╮
隐瞒了意图╮ 2020-12-28 15:41

In django, what\'s the difference between a ManyToOneRel and a ForeignKey field?

相关标签:
2条回答
  • 2020-12-28 16:12

    Django relations model exposes (and documents) only OneToOneField, ForeignKey and ManyToManyField, which corresponds to the inner

    • OneToOneField -> OneToOneRel
    • ForeignKey -> ManyToOneRel
    • ManyToManyField -> ManyToManyRel

    See source of django.db.models.fields.related for further details.

    0 讨论(0)
  • 2020-12-28 16:27

    ManyToOneRel is not a django.db.models.fields.Field, it is a class that is used inside Django but not in the user code.

    0 讨论(0)
提交回复
热议问题