36

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

sfendell
  • 5,415
  • 8
  • 25
  • 26

2 Answers2

54

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.

Yauhen Yakimovich
  • 13,635
  • 8
  • 60
  • 67
49

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

wRAR
  • 25,009
  • 4
  • 84
  • 97