The documentation on contenttypes says this:
If you know which models you’ll be
using most often, you can also add a
“reverse” generic relationship to
enable an additional API.
But what’s their practical use? I fail to understand.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you have a model with:
But you know you will do often:
Instead of doing get_kitchen() manually, you can add the reverse relationship in the
Vegetablemodel and it will get theKitchenfor you.This kind of reverse relation is automaticly added to the other model for OneToMany relation using
ForeignKeybecause you know which models are going to be on the both sides of the relation.Since with generic relation, it can be any model, Django doesn’t add the reverse relation for you. You have to specify it manually if you feel that you need it.