Search code examples
djangomigrationdjango-cms

djangocms: move data from deprecated cmsplugin-filer-*-plugins to djangocms-*-plugins


Since the cmsplugin-filer-*-plugins are deprecated with django-cms 3.5, I need a way to keep my plugins with moving them to the newer djangocms-*-plugins.

I am using the cmsplugin-filer plugins FilerFile, FilerFolder and FilerImage. Also I got a custom plugin which inherits from FilerImage. I need to move those to the newer djangocms-file-file, djangocms-file-folder and djangocms-picture without losing my plugins / data.


Solution

  • After some time working on a migration I came to this solution: https://gist.github.com/wfehr/86ac31e8e263b872b746cc721662251e

    The gist provides a migration to move the data between the said third-party-apps and keep alls the plugins/data and change them to the supported ones.

    I hope this will help someone facing the same problems:)

    (The migration code itself may not be the perfect solution, but it gets the job done)

    EDIT:

    The linked migration can be used in any application of yours. Just put it in there as the next following migration, for example you have already "0011_added_new_model.py", then put in the file as "0012_filer_deprecation_move.py". Then you have to add the migration 0011 in the dependencies, as seen in other (default) migrations.

    TLDR: The above migration is a single, standalone migration. It is called as any other migration with python manage.py migrate [app] [migration] and you can put it in "any" app you want (where it makes the most sense to you).