Aiky30 / djangocms-4-migration

BSD 3-Clause "New" or "Revised" License
5 stars 13 forks source link

Fix references to pages that are to be deleted #12

Open stefanw opened 1 year ago

stefanw commented 1 year ago

Models (e.g. CMS plugins) that use cms.models.fields.PageField or other references to cms.Page can break with IntegrityError when trying to delete the Pages in the migration_cleanup step.

Before deleting a page:

I'm not sure this is the right approach depending on your models, e.g. this will also re-assign CMS Page Permissions which might not be desired. However, this was blocking the deletion of the superfluous Page objects and this code unblocked that step.

Will-Hoey commented 7 months ago

@stefanw has there been any further movement on this?

stefanw commented 7 months ago

@Will-Hoey The code is slightly specific to your site's requirements. It works for us and if it works for more people it might be worth adding as an option.

Will-Hoey commented 5 months ago

@stefanw thanks for the reply! I ended up forking your branch and extending it slightly to fit my case