hvad.utils
¶
-
hvad.utils.
combine
(trans)¶ Combines a Shared Model with a Translations Model by taking the Translations Model and setting it onto the Shared Model‘s translations cache.
-
hvad.utils.
get_cached_translation
(instance)¶ Returns the cached translation from an instance or
None
.
-
hvad.utils.
get_translation_aware_manager
(model)¶ Returns a manager for a normal model that is aware of translations and can filter over translated fields on translated models related to this normal model.
-
class
hvad.utils.
SmartGetFieldByName
¶ Smart version of the standard
get_field_by_name()
on the options (meta) of Django models that raises a more useful exception when one tries to access translated fields with the wrong manager.-
__init__
(self, real)¶
-
__call__
(self, meta, name)¶
-
-
hvad.utils.
permissive_field_by_name
(self, name)¶ Returns the field from the Shared Model or Translations Model, if it is on either.