Aiky30 / djangocms-4-migration

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

django CMS 4 Migration

Warning: If the migration process fails to complete you will not be able to undo the changes without reloading a database backup. We cannot be held accountable for any data loss sustained when running the commands provided in this project. Please keep a database backup before running any commands provided by this package.

When do I need this package?

This package is designed to migrate a django CMS 3.5+ project to django CMS 4.0.

What does this package do?

Limitations

Due to the nature of the changes between django CMS 3.5+ and 4.0 the package will fail to function if an incompatible package is installed.

This may require you to:

Prerequisites

Require knowledge of the changes and new features in 4.0:

Requires knowledge of django CMS Versioning

Install the following packages

The following packages are not yet officially released, they need to be installed directly from the repository. We need your help to make packages v4.0 compatible and to provide documentation for the wider community!

django CMS 4.0

pip install http://github.com/divio/django-cms/tarball/release/4.0.x#egg=django-cms

djangocms-text-ckeditor

pip install https://github.com/divio/djangocms-text-ckeditor/tarball/support/4.0.x#egg=djangocms-text-ckeditor

djangocms-versioning

pip install https://github.com/divio/djangocms-versioning/tarball/master#egg=djangocms-versioning

djangocms-alias

pip install https://github.com/divio/djangocms-alias/tarball/master#egg=djangocms-alias

Installation

Warning: This package can leave your DB in a corrupted state if used incorrectly, be sure to backup any databases prior to running any commands listed here!

First install this package in your project

pip install djangocms-4-migration

Configuration

If you have a custom user model, you should designate a "migration user" by specifying the user ID in your settings like so:

CMS_MIGRATION_USER_ID = <user id>

Running

Simply run the following command to run the data migration. Note: This command calls the django migrate command, this is because it has to run commands that save information that would have been lost by running the cms migrations directly.

python manage.py cms4_migration

Common solutions for django CMS 4.0 compatibility

Import PageContent in a backwards compatible way (Title).


# django CMS v4
try:
    from cms.models import PageContent
# django CMS 3.x
except ImportError:
    from cms.models import Title as PageContent