Django patterns, part 2: efficient reverse lookups
One of the main sources of unnecessary database queries in Django applications is reverse relations.
By default, Django doesn't do anything to follow relations across models. This means that unless you're careful, any relationship can lead to extra hits on the database. For instance, assuming MyModel has a ...
more ...