nani.utils

nani.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.

nani.utils.get_cached_translation(instance)

Returns the cached translation from an instance or None.

nani.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 nani.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)
nani.utils.permissive_field_by_name(self, name)

Returns the field from the Shared Model or Translations Model, if it is on either.

Project Versions

Previous topic

nani.models

Next topic

nani.compat.date

This Page