KristianOellegaard/django-hvad — pull request #171 by spectras (2014-05-16 06:18:08+00:00)
Title: Fix #72: TranslationQueryset.language() should be lazy

Changes the call to `queryset.language()` so that it just stores None and defers actual filtering until query moment. This allows using `MyModel.objects.language()` in form definitions, and have the queryset call `get_language()` in the request/response context.
Also, as all other functions in the queryset family are lazy, I believe it is the right thing not to have `language()` stand out of the pack.

As a side effect, multiple calls to `language('xx')` now replace each other instead of returning an empty set.

Note though: __This change may break existing projects__

Pull request includes a new _deferred_language_ test for all test cases in `hvad.tests.query`. I will add a form test as well, as it is the issue that started it.