Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to "morph" certain page types into one other #77

Open
vdboor opened this issue Jun 19, 2015 · 2 comments
Open

Be able to "morph" certain page types into one other #77

vdboor opened this issue Jun 19, 2015 · 2 comments

Comments

@vdboor
Copy link
Contributor

vdboor commented Jun 19, 2015

It would be useful for some page types to be able to "upgrade" or "replace" themselves with a different page type. For example, replacing a regular page with a redirect, or upgrading a FlatPage to a FluentPage

@mrmachine
Copy link
Contributor

Yep. We had this issue a little while back too, when we started out with one page type then during development switched to another more advanced page type. But the different page types will probably have different fields, and it might not be (probably often won't be) the case that you can easily just convert them.

I imagine it will involve a data migration, so perhaps some helper functions provided by django-polymorphic or django-fluent-pages could make it easier to write data migrations, and some docs, would do the trick?

@vdboor
Copy link
Contributor Author

vdboor commented Jun 19, 2015

Exactly. The idea is to "tear down / remove" the derived class only, and create a new subclass in it's place + update the polymorphic_ctype field. Next, I think both classes also need a method which they can override, so they can remove any additionally linked models (such as translations, or M2M relations) that would remain stale in the database otherwise. In case of the FluentContentsPage, it could remove the ContentItem objects unless the new page also inherits from FluentContentsPage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants