This is the queryset used by the hvad.manager.TranslationManager.
While most methods on hvad.manager.TranslationQueryset querysets run using the same amount of queries as if they were untranslated, they all do slightly more complex queries (one extra join).
The following methods run two queries where standard querysets would run one:
hvad.manager.TranslationQueryset.get_or_create() runs one query if the object exists, three queries if the object does not exist in this language, but in another language and four queries if the object does not exist at all. It will return True for created if either the shared or translated instance was created.
Methods described here are unique to django-hvad and cannot be used on normal querysets.
Sets the language for the queryset to either the language code defined or the currently active language. This method should be used for all queries for which you want to have access to all fields on your model.
Returns a hvad.manager.FallbackQueryset instance which by default does not fetch any translations. This is useful if you want a list of Shared Model instances, regardless of whether they’re translated in any language.
Note
No translated fields can be used in any method of the queryset returned my this method. See FallbackQueryset
Note
This method is only available on the manager directly, not on a queryset.
Deletes all Translations Model instances in a queryset, without deleting the Shared Model instances.
The following are methods on a queryset which are public APIs in Django, but are not implemented (yet) in django-hvad:
Using any of these methods will raise a NotImplementedError.
This is a queryset returned by untranslated, which can be used both to get the untranslated parts of models only or to use fallbacks. By default, only the untranslated parts of models are retrieved from the database.
Warning
You may not use any translated fields in any method on this queryset class.
Returns a queryset which will use fallbacks to get the translated part of the instances returned by this queryset. If fallbacks is given as a tuple of language codes, it will try to get the translations in the order specified. Otherwise the order of your LANGUAGES setting will be used.
Warning
Using fallbacks will cause a lot of queries! In the worst case 1 + (n * x) with n being the amount of rows being fetched and x the amount of languages given as fallbacks. Only ever use this method when absolutely necessary and on a queryset with as few results as possibel.