Django compatibility

This package has been tested with:

  • Django versions 1.5, 1.6, 1.7, 1.8 and 1.9
  • Python versions 2.6, 2.7, 3.3 and 3.4

Using multiple filter() calls

Since translated fields live in a separate model, they can be filtered like any normal relation:

object = MyObject.objects.filter(translations__title='cheese omelet')

translation1 = myobject.translations.all()[0]

However, if you have to query a language or translated attribute, this should happen in a single query. That can either be a single filter(), translated() or active_translations()) call:

from parler.utils import get_active_language_choices


Queries on translated fields, even just .translated() spans a relationship. Hence, they can’t be combined with other filters on translated fields, as that causes double joins on the translations table. See the ORM documentation for more details.

The ordering meta field

It’s not possible to order on translated fields by default. Django won’t allow the following:

from django.db import models
from parler.models import TranslatableModel, TranslatedFields

class MyModel(TranslatableModel):
    translations = TranslatedFields(
        title = models.CharField(max_length=100),

    class Meta:
        ordering = ('title',)  # NOT ALLOWED

    def __unicode__(self):
        return self.title

You can however, perform ordering within the queryset:


You can also use the provided classes to perform the sorting within Python code.

Using search_fields in the admin

When translated fields are included in the search_fields, they should be includes with their full ORM path. For example:

from parler.admin import TranslatableAdmin

class MyModelAdmin(TranslatableAdmin):
    search_fields = ('translations__title',)

Using prepopulated_fields in the admin

Using prepopulated_fields doesn’t work yet, as the admin will complain that the field does not exist. Use get_prepopulated_fields() as workaround:

from parler.admin import TranslatableAdmin

class MyModelAdmin(TranslatableAdmin):

    def get_prepopulated_fields(self, request, obj=None):
        # can't use `prepopulated_fields = ..` because it breaks the admin validation
        # for translated fields. This is the official django-parler workaround.
        return {
            'slug': ('title',)

Using fieldsets in Django 1.4

When using Django 1.4, there is a small tweak you’ll have to make in the admin. Instead of using fieldsets, use declared_fieldsets on the ModelAdmin definition.

The Django 1.4 admin validation doesn’t actually check the form fields, but only checks whether the fields exist in the model - which they obviously don’t. Using declared_fieldsets instead of fieldsets circumvents this check.