[Django]-Difference between ManyToOneRel and ForeignKey?

51👍

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

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.

Leave a comment