Skip to content

Translatable ModelAdmin

Wagtail Localize supports translation of custom Wagtail's ModelAdmin registered models.

Installation

Add wagtail_localize.modeladmin to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    "wagtail_localize.modeladmin",
]

How to use

When registering your custom models you can use the supplied TranslatableModelAdmin in place of Wagtail's ModelAdmin class.

from wagtail.contrib.modeladmin.options import modeladmin_register
from wagtail_localize.modeladmin.options import TranslatableModelAdmin

from .models import MyTranslatableModel


class MyTranslatableModelAdmin(TranslatableModelAdmin):
    model = MyTranslatableModel


modeladmin_register(MyTranslatableModelAdmin)

That's it! You can translate your custom ModelAdmin models in the admin dashboard the same way you would Wagtail snippets.