# parler.managers module

Custom generic managers

## The `TranslatableManager` class

class parler.managers.TranslatableManager(*args, **kwargs)

  The manager class which ensures the enhanced TranslatableQuerySet object is used.

  get_queryset()

    Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

## The `TranslatableQuerySet` class

class parler.managers.TranslatableQuerySet(*args, **kwargs)

  An enhancement of the QuerySet which sets the objects language before they are returned.

  When using this class in combination with django-polymorphic, make sure this class is first in the chain of inherited classes.

  active_translations(language_code=None, **translated_fields)

    Only return objects which are translated, or have a fallback that should be displayed.

    Typically that’s the currently active language and fallback language. This should be combined with `.distinct()`.

    When `hide_untranslated = True`, only the currently active language will be returned.

  create(**kwargs)

    Create a new object with the given kwargs, saving it to the database and returning the created object.

  language(language_code=None)

    Set the language code to assign to objects retrieved using this QuerySet.

  translated(*language_codes, **translated_fields)

    Only return translated objects which of the given languages.

    When no language codes are given, only the currently active language is returned.

    Note

    Due to Django ORM limitations, this method can’t be combined with other filters that access the translated fields. As such, query the fields in one filter:

        qs.translated('en', name="Cheese Omelette")

    This will query the translated model for the `name` field.