wagtail-localize icon indicating copy to clipboard operation
wagtail-localize copied to clipboard

Can't translate a page with a OneToOneField

Open drcongo opened this issue 2 years ago • 2 comments

I'm not sure yet if this is a Wagtail-localize issue or a Wagtail issue, but if you have a page with a OneToOneField then trying to translate it fails silently with no errors logged.

class TopicPage(Taggable, LandingPageType):

    class Meta:
        verbose_name = 'Topic page'

    topic = models.OneToOneField(
        'taxonomy.PageTag',
        null=False,
        blank=False,
        on_delete=models.PROTECT,
        related_name='topic_page',
        help_text=_("The topic this page is about")
    )

In the Reports->Translations section, these show up without a page title...

Screen Shot 2022-03-16 09 18 03 AM

The (French) bit in there is linking to the page I'm already on. It kinda feels like this is obvious that the system wouldn't be able to duplicate a page with a OneToOneField as that would no longer be one to one, but the fact that the translations appear (although broken) in the reports could be misleading for a site editor.

drcongo avatar Mar 16 '22 09:03 drcongo

I find it odd that it fails silently 🤔 Perhaps we're not doing appropriate cleanup. If you happened to dig into this more, any further details will be greatly appreciated.

zerolab avatar Mar 18 '22 19:03 zerolab

I'll see what I can find @zerolab - I should mention I hadn't noticed 1.1 was out at the point I posted this so this was the prior version.

drcongo avatar Mar 22 '22 16:03 drcongo