Skip to main content

Wagtail Parler 🧀 🐦

Stable Version Code style: ruff Checked with mypy Imports: isort semver Documentation Status

Brings "omelette du fromage" 🧀 from parler into wagtail 🐦 for your custom models (via modeladmin or wagtail snippets)

Wagtail Parler Logo

Wagtail Parler helps you to use django-parler inside wagtail to translate your customs models. It works for wagtail-modeladmin (which is now deprectaed) and also the new official way: wagtail's snippets.

Translated and untranslated tabs

Tests, QA, consistency and compatibility

This app is tested to runs with:

  • Django 4.2, 5.2
  • Wagtail 5.0, 5.1, 5.2, 6.3, 7.0, 7.1, 7.2
  • Parler 2.3 (probably older ones to, it's just not tested)
  • Python 3.9, 3.11

To ensure code quality and consistency:

Why

There is already an internationalisation support in wagtail via their own language features called wagtail-localize. This app also support wagtail modeladmin. But the approach of wagtail-localize could be unconvenient as translations are stored in the same table than "main instances", resulting specific queryset and managers to manage your models.
For app's like treebeard, it can break the logic of your tree.

For those reasons, you could prefer to use django-parler as translations approach. Wagtail Parler is fit to you: it will allow you to use django-parler to translate your own models and still have a usefull wagtail interface to manage translations (via official wagtail's snippet admin but also with the old wagtail-modeladmin)

Installation

Install the package via pip. We consider you already have django-parler and wagtail installed.

pip install wagtail-parler

Then, in settings.py, add wagtail_parler to the installed apps.

# settings.py

INSTALLED_APPS = [
    # "wagtail.users" # for wagtail >= 7
    # …
    "wagtail_parler",
    # …
]

ATTENTION! Since wagtail 7, you need also to add wagtail.users in the installed app if not already done!

Basic Usage

You just have to add ParlerSnippetAdminMixin to your SnippetViewSet (or ParlerModelAdminMixin to your ModelAdmin), et voilà, you are ready to eat omelette du fromage.

from wagtail.snippets.views.snippets import SnippetViewSet
from wagtail.snippets.models import register_snippet
from wagtail_parler.handlers import ParlerSnippetAdminMixin
from .models import Food


class FoodAdmin(ParlerSnippetAdminMixin, SnippetViewSet):
    model = Food

register_snippet(FoodAdmin)

# or for an usage with wagtail-modeladmin:

from wagtail_modeladmin.options import ModelAdmin, modeladmin_register
from wagtail_parler.handlers import ParlerModelAdminMixin
from .models import Food

class FoodAdmin(ParlerModelAdminMixin, ModelAdmin):
    model = Food

modeladmin_register(FoodAdmin)

Add languages info in the admin

A custom column LanguagesColumn is also available to display languages translations state.

...
from wagtail_parler.admin.columns import LanguagesColumn

class FoodAdmin(ParlerSnippetAdminMixin, SnippetViewSet):
    model = Food
    list_display = [..., LanguagesColumn("translations"), ...]

register_snippet(FoodAdmin)

Doest it support PreviewableMixin ?

Yes it does. When user change the translation tab, preview is updated with translated data from the form. Same behaviour when a data is updated of course.

Doest it support RevisionMixin ?

Yes it does, but you need to inherit from wagtail_parler.models.WagtailParlerModel instead of parler.models.TranslatableModel. eg:

# Django imports
from django.db import models
from django.utils.translation import gettext_lazy as _

# Third Party
from wagtail.models import RevisionMixin
from wagtail_parler.models import WagtailParlerModel
from parler.models import TranslatedFields


class Food(RevisionMixin, WagtailParlerModel):
    slug = models.SlugField(
        verbose_name=_("Slug"),
        blank=False,
        null=False,
    )
    translations = TranslatedFields(
        name=models.CharField(_("Nom"), max_length=255, blank=False, null=False),
        summary=models.TextField(_("Résumé"), blank=False, null=False),
        content=models.TextField(_("Contenu"), blank=False, null=False),
    )

Extra 🧀🐦

More advanced usage, tests, etc., are documented in the doc.

Maître Wagtail, sur un arbre perché,
Tenait en son bec une omelette du fromage.
Maître Webu, à l'envie de parler,
Lui tint à peu près ce langage :
Et bonjour, Monsieur Wagtail.
Que de beaux commits ! quelle merveille !
Sans mentir, si votre codage
Se rapporte à votre plumage,
Vous êtes le Phénix des hôtes de ces dépots. …

From « Le Corbeau et le Renard » by Jean de La Fontaine, 1668.

Metadata

Release files for wagtail-parler 0.7.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wagtail-parler 0.7.8
File Size Uploaded
wagtail_parler-0.7.8.tar.gz 29.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-parler 0.7.8
File Interpreter ABI Platform
wagtail_parler-0.7.8-py3-none-any.whl Python 3 none any Details

Total release size: 63.1 kB

Release files / wagtail_parler-0.7.8.tar.gz

Download URL wagtail_parler-0.7.8.tar.gz
Size 29.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6506aaa1a4385ca74b958046cd8c08671ec4fa35e394fe674e726f72e6e2e495
BLAKE2b-256 checksum
How to use checksums
5bd323f24f81eae506c96c3ef875fd976648d0bc2a5a64150db405e3842f8840
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / wagtail_parler-0.7.8-py3-none-any.whl

Download URL wagtail_parler-0.7.8-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
620e87a0e9f7fd3c2128e3839a5c1da8225a5ca8eba44305414dfbf452506d49
BLAKE2b-256 checksum
How to use checksums
dde434b09af4d89c704730091865ce53dc3889c5d4a3c0290b7429d1aa7c7052
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

0.7.8 This release

2 release files

0.7.7

2 release files

0.7.5

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.2

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page