Use correct exception

This commit is contained in:
Ramon Wenger 2023-08-30 18:15:26 +02:00
parent 7707104da4
commit 569f8a3823
1 changed files with 2 additions and 1 deletions

View File

@ -1,3 +1,4 @@
from wagtail.actions.copy_for_translation import ParentNotTranslatedError
from wagtail.models import Locale, Page
from books.models.module import Module
@ -53,7 +54,7 @@ def convert_page_to_translation(slug: str, original_slug: str, language_code="en
logger.debug("Creating topic translation")
try:
translated_topic = translate_page(topic, locale)
except Page.DoesNotExist:
except ParentNotTranslatedError:
# let's try to translate the parent page too
translate_page(topic.get_parent(), locale)
translated_topic = translate_page(topic, locale)