KristianOellegaard/django-hvad — pull request #192 by spectras (2014-07-04 06:06:03+00:00)
Title: Refactor select_related to support Django semantics and deep caching.

This is a full refactor of `select_related()` for TranslationQueryset.
From the outsite, it makes the following changes:
- support for arbitrarily deep `select_related()` clauses.
- accurate support of Django semantics, including v1.7+ breakup.
- lazy resolution of field references.

The internals have been redone, building on the `_add_language_filter` method added a few months ago. This patch ensures it is always called once and only once, allowing:
- removal of “safety methods” that were needlessly applying the filters just to be sure.
- loosening of constraints on `_add_language_filter` as it does not need to be idempotent anymore.
Tracking is done by tagging the queryset when language filters are applied. Tag is passed along in `_clone` and will make `_add_language_filter` raise if called again.

Tests pass. New tests have been added for deep recursion caching. Documentation updates included.
Please note that accurate support of Django semantics might break some projects that rely on current, broken behavior.