I can choose Page type (Page model) in Wagtail admin on creation. This feature is documented: http://docs.wagtail.io/en/latest/editor_manual/new_pages/selecting_a_page_type.html
Is it possible, though, to alter page type in Wagtail admin after the page was created? And is there a way to alter page type programmatically?
There is no way to alter the page type after it is created using the admin panel in my best knowledge. I have encountered the same problem and I manage to solve it by editing database entry. I am not sure that is the right thing to do or not.
I have mistakenly made a page ('StandardPage' instead of 'StandardIndexPage') and I want to correct it. I can't delete and recreate this page as it has another tree structure below it. So I follow the following steps to change page type.
Select any page which is the type you want to change your page. Then get the id of it.
Go to 'wagtailcore_page' table and see the 'content_type_id' of both pages.
Double check the content type is correct or not in 'django_content_type' table.
Go to the database and check the entries for it in an appropriate table in my case 'home_standardpage'. Double check everything.
Go to the new class table where you want to move (home_standardindexpage) and check the requirements. Add an entry with your page id(120 for the above example). Then save the entry.
Then that will change your page type. Please take extra care as you are editing in a database. First try it in local replica then only change it in the real product.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With