In Django, you create models and you can optionally specify a foreign key in the field
class Man:
...
class Dog:
...
owner = models.ForeignKey(Man, on_delete=models.SET_NULL)
Then you can request each Dogfor its respective owner or get all dogs forMan
owner = some_dog.owner
all_dogs = some_man.dog_set.all()
If you do not want to create the inverse relation specified by docs , you can do
class Man:
...
class Dog:
...
owner = models.ForeignKey(Man, on_delete=models.SET_NULL, related_name='+')
Now you no longer have access to all_dogs = some_man.dog_set.all().
However, does this add an extra “build” to the inverse relationship overhead?
If I had never used all_dogs = some_man.dog_set.all(), it would be important, I pointed related_name='+'in Dog? Could this slow down the job?
Django, related_name='+' ?