Search code examples
pythondjangomigrationdjango-cms

check for unsaved django-cms plugin instances


I have a django-cms instance which we have recently migrated from v2.4.3 to v3.0.12. We are now struggling to get it 100% stable.

I have run the command

manage.py cms check

and got some errors. I can understand all of them but the following:

Plugin instances
================

  - Plugin instances of 72 types found in the database [OK]
  - DepartmentTitlePlugin has 2 unsaved instances [ERROR]
  - PicturePlugin has 5 unsaved instances [ERROR]

There are potentially serious problems with the plugins in your database. 
Even if your site works, you should run the 'manage.py cms list plugins' 
command and then the 'manage.py cms delete_orphaned_plugins' command. 
This will alter your database; read the documentation before using it. [ERROR]

Can anyone clarify the meaning of this error? I am afraid that delete_orphaned_plugins could delete some important plugins so wouldn't be a good solution. I don't really know what to do here.

Any feedback? Thanks :-)

.sogeking


Solution

  • Such unsaved or orphaned plugins happen if you start creating a new plugin in the frontend editor, but then close the window without saving. django CMS has gotten better over time in cleaning up such unsaved instances, but it isn't quite perfect yet. There's an ongoing effort to not create the "unsaved" instances in the first place, but this is quite complex and won't make it before the 3.2 release at the least.

    That being said, it should be safe to run python manage.py cms delete-orphaned-plugins --noinput in order to delete the unsaved instances. Nevertheless, make sure you have a working database backup before running it.