Skip to content

Is there a way to trigger sync of the page when the original language version is edited? #570

Answered by chris48s
Algoinde asked this question in Q&A
Discussion options

You must be logged in to vote

It doesn't exist in core or localize out of the box, but you could implement what you're suggesting with a small hook. I haven't tested this snippet, but I think this would do what you're suggesting:

from wagtail.core import hooks
from wagtail_localize.models import TranslationSource

@hooks.register('after_edit_page')
def after_edit_page(request, page):
    source = TranslationSource.objects.get_for_instance(page)
    source.update_from_db()

or you might consider doing it on after_publish_page.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Algoinde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants