Skip to content

How to Use DjangoCMS Transfer

W. Bomar edited this page Mar 4, 2022 · 1 revision

Purpose

Recreate or Save plugin configuration on pages even across different CMS projects.

Instructions

  1. Watch djangocms-transfer README video.
  2. Import/Export plugins to achieve your task.

Gotchas

It does not support foreign key relations and won't import/export related data. — djangocms-transfer Readme

This means that users should delete images (and other media) before exporting. See Workarounds.

Workarounds

  • Before export, remove images (and other media) from the page Structure.
  • After export, remove media entries from the .json (remove entire object).
  • After export, remove foreign key relations from the .json (change any "internal_link"'s to null).
  • After export, fix any snippet references (ensure desired snippet exists, then change "snippet"'s to correct ID).

Use Cases

Replicate Frontera Homepage to Create Sandbox for Testing Major Changes

@tacc-wbomar, to backup instances removed by FP-1360, used this plugin to export all Article List/Preview instances (sans media) (with snippets) from https://dev.fronteraweb.tacc.utexas.edu. He performed all of the workarounds, then imported the instances to his local standalone CMS instance. When all workarounds are performed, there are no errors.

This plugins-frontera-home-2021-03-with-plugins--mod-for-import.zip includes two JSON files: one before workarounds, and one after workarounds.

How to Test Plugin

High-Level Steps
  1. Have two independent CMS instances to test on.
  2. Create Text, Image, and Snippet plugin on instance A.
  3. Export plugins from instance A.
  4. Import plugins to instance B.
  5. ⓧ Expect failure, because of "Gotchas".
  6. Perform all "Workarounds" (export again if necessary).
  7. Import plugins to instance B.
  8. ✓ Expect success.
Detailed Steps

If "High-Level Steps" is too high-level, please try this instead:

  1. Be able to Test CMS Changes across multiple CMS instances. Both need:
    • Either this branch, test/djangocms-transfer.
    • Or an image built from this branch, taccwma/core-cms:e64b689 (job).
  2. (On local CMS) In both CMS's docker containers, run pip install -r requirements.txt.
  3. On CMS instance A, login to CMS admin.
  4. Create page.
  5. Create "Text" plugin instance.
  6. Create "Image" plugin instance (with uploaded image).
  7. Create snippet plugin instance (with a created snippet).
  8. Export plugins (see [djangocms-transfer README] video).
  9. On CMS instance B, login to CMS admin.
  10. Create page.
  11. Import plugins (see [djangocms-transfer README] video).
  12. ⓧ Expect failure, because of "Gotchas".
  13. Perform all "Workarounds" (export again if necessary).
    • Ensure CMS instance B has a matching snippet.
  14. Import plugins.
  15. ✓ Expect success.