Constant to identify Shared Model classes.


Constant to identify Translations Model classes.


Constant to identify normal models.


Caches the model informations in a dictionary with the model class as keys and the return value of _build_model_info() as values.


Builds the model information dictionary for a model. The dictionary holds three keys: 'type', 'shared' and 'translated'. 'type' is one of the constants TRANSLATIONS, TRANSLATED or NORMAL. 'shared' and 'translated' are a list of shared and translated fieldnames. This method is used by get_model_info().


Returns the model information either from the MODEL_INFO cache or by calling _build_model_info().

hvad.fieldtranslator._get_model_from_field(starting_model, fieldname)

Get the model the field fieldname on starting_model is pointing to. This function uses get_field_by_name() on the starting model’s options (meta) to figure out what type of field it is and what the target model is.

hvad.fieldtranslator.translate(querykey, starting_model)

Translates a querykey (eg 'myfield__someotherfield__contains') to be language aware by spanning the translations relations wherever necessary. It also figures out what extra filters to the Translations Model tables are necessary. Returns the translated querykey and a list of language joins which should be used to further filter the queryset with the current language.