pythondjangodjango-modelsdjango-templatesdjango-parler

Django: How to create a multilingual website


I wanto create a multilingual website in Django and I tried using django-parler but when I want to add an object by the admin, the admin doesn't show the translatedfield

Here is a part of my models:

class Movie(TranslatableModel):

    translations = TranslatedFields(
        synopsis=RedactorField(
            verbose_name=u'Sinopsis',
            allow_file_upload=False,
            allow_image_upload=True,
        ),
        data_sheet=RedactorField(
            verbose_name=u'Sinopsis',
            allow_file_upload=True,
            allow_image_upload=True,
        ),
    )
    name = models.CharField(verbose_name='nombre', max_length=250)

And my parler settings:

PARLER_DEFAULT_LANGUAGE = 'es'

PARLER_LANGUAGES = {
    1: (
        {'code': 'es', },
        {'code': 'en', },
    ),
    'default': {
        'fallback': 'es',
        'hide_untranslated': False,
    }
}

Solution

  • You need to change the accompanying admin.py file too:

    from parler.admin import TranslatableAdmin
    
    
    class MovieAdmin(TranslatableAdmin):
        model = Movie