wagtailtrans
wagtailtrans copied to clipboard
Update inheritance of TranslatablePage for better migration support
At the moment, there are some people experiencing migrating issues when implementing Wagtailtrans, this is due to the inheritance of Page
<> TranslatablePage
and not allowing to have a None
value in the fields page_ptr_id
and translatablepage_ptr_id
.
To make it easier for people to integrate wagtailtrans we should investigate and try to find a solid solution for this.
I have issues with creating pages in a tree. I can create lang trees of empty pages but I cant populate pages with content. The error when I try to save page is was complaining abot some basic fields can not be empty (slug, title and some one field more I can't remember) The bug is like this one: https://github.com/wagtail/wagtail/issues/1617
I spent some hours debugging this issue. I started from scratch again and again rewriting my page models completely. I excluded any migrations from the process (no migrations being made, I deletet pg database several times and started to populate it again and again).
And finally I got it: My page models shoud be inherited stricly from TranslatablePage
and not from TranslatablePage, Page
as it stated in the documentation:
https://wagtailtrans.readthedocs.io/en/latest/getting_started.html
Now my trees works fine, but the info in the docs is wrong.
@remort Thanks for taking the time to log this. The inheritance from both page and translatable page was used in an older version. The docs are updated in pr #128
Guys, you have outdated docs online. And people have issues making websites following it. Please update the documentation. And thank you for this library. It's great !
I think moving to a mixin would solve this: https://github.com/wagtail/wagtailtrans/issues/152
The only downsides I can think of is it would be a little bit harder to query all pages for a given language and different language versions of a page must be the same type.
The upsides are: much easier initial migration, performance and possibility of using it with snippets
I think so too.
If we provide a utility for querying these pages it shouldn't be a problem. Keeping the page type the same is not changing anything with the current implementation, so shouldn't be a problem either. However we should be careful with migrations, think it's important to have all existing solutions migrate as easy as possible.
Especially like the upsides of moving to a mixin 👍 , think using it with snippets / other objects is definitely a big win, I even think we've created this issue for that case.