djangocms-transfer


Namedjangocms-transfer JSON
Version 2.0.0 PyPI version JSON
download
home_pageNone
SummaryAdds import and export of plugin data.
upload_time2025-08-09 07:50:48
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseBSD-3-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            ===================
django CMS Transfer
===================

|pypi| |coverage| |python| |django| |djangocms|


**django CMS Transfer** is an **experimental** package that allows you to export
and import plugin data from a page or a placeholder. It does not support foreign
key relations and won't import/export related data, such as `media <https://github.com/django-cms/djangocms-transfer/issues/18>`_.

.. note::

        This project is endorsed by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_.
        That means that it is officially accepted by the dCA as being in line with our roadmap vision and development/plugin policy.
        Join us on `Slack <https://www.django-cms.org/slack/>`_.

.. image:: preview.gif


Documentation
=============

The setting ``DJANGO_CMS_TRANSFER_SERIALIZER`` allows registration of a custom JSON serializer. An example use case would be subclassing Django's built-in Python serializer to base64-encode inline image data.

See ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/djangocms-transfer/blob/master/setup.py>`_
file for additional dependencies:



Installation
------------

For a manual install:

* run ``pip install djangocms-transfer``
* add ``djangocms_transfer`` to your ``INSTALLED_APPS``


Version Compatibility
---------------------

For django CMS 4.0 or later, you must use djangocms-transfer 2.0 or later.

For django CMS 3.7 through 3.11 use versions 1.x of djangocms-transfer.


How to Use
----------

To export/import a page, click on the "*Page*" menu on the toolbar
and select your desired choice.

To export/import a plugin, Open the "*Structure board*", click on the
dropdown menu for the specific plugin and select your choice.


Customization
-------------

Following settings are available:

* **DJANGOCMS_TRANSFER_PROCESS_EXPORT_PLUGIN_DATA**:

  Enables processing of plugin instances prior to serialization, e.g.
  ``myapp.module.function``.

* **DJANGOCMS_TRANSFER_PROCESS_IMPORT_PLUGIN_DATA**:

  Enables processing of plugin instances prior to saving, e.g.
  ``myapp.module.function``.
  For example: set default-values for ForeignKeys (images for django_filer, ..)

As an example the combination of ``_PROCESS_EXPORT_PLUGIN_DATA`` and
``_PROCESS_IMPORT_PLUGIN_DATA`` lets you export and import the data between
different systems while setting the contents as you need it::

    # settings.py
    .._PROCESS_EXPORT_PLUGIN_DATA = "myapp.some.module.export_function"
    .._PROCESS_IMPORT_PLUGIN_DATA = "myapp.some.module.import_function"

    # custom functions
    def export_function(plugin, plugin_data):
        # remove child-plugins which can't be handled
        if plugin.parent_id and plugin.parent.plugin_type == "SomeParentPlugin":
            return None
        # change data
        if plugin.plugin_type == "SomePlugin":
            plugin_data["data"].update({
                "some_field": "TODO: change me",
            })
        return plugin_data

    def import_function(deserialized_object):
        some_related_object = MyModel.objects.first()
        for field in deserialized_object.object._meta.fields:
            # example of setting a default value for a related field
            if isinstance(field, ForeignKey):
                value = getattr(deserialized_object.object, field.attname)
                if field.related_model == MyModel and value is not None:
                    setattr(deserialized_object.object, field.name, some_related_object)


Running Tests
-------------

You can run tests by executing::

    python -m venv env
    source env/bin/activate
    pip install -r tests/requirements/dj51_cms41.txt
    coverage run tests/settings.py


*******************************************
Contribute to this project and win rewards
*******************************************

Because this is an open-source project, we welcome everyone to
`get involved in the project <https://www.django-cms.org/en/contribute/>`_ and
`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.
Become part of a fantastic community and help us make django CMS the best CMS in the world.

We'll be delighted to receive your
feedback in the form of issues and pull requests. Before submitting your
pull request, please review our `contribution guidelines
<http://docs.django-cms.org/en/latest/contributing/index.html>`_.

We're grateful to all contributors who have helped create and maintain this package.
Contributors are listed at the `contributors <https://github.com/django-cms/djangocms-transfer/graphs/contributors>`_
section.


.. |pypi| image:: https://badge.fury.io/py/djangocms-transfer.svg
    :target: http://badge.fury.io/py/djangocms-transfer
.. |coverage| image:: https://codecov.io/gh/django-cms/djangocms-transfer/branch/master/graph/badge.svg
    :target: https://codecov.io/gh/django-cms/djangocms-transfer

.. |python| image:: https://img.shields.io/badge/python-3.9+-blue.svg
    :target: https://pypi.org/project/djangocms-transfer/
.. |django| image:: https://img.shields.io/badge/django-4.2,%205.0,%205.1-blue.svg
    :target: https://www.djangoproject.com/
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-4-blue.svg
    :target: https://www.django-cms.org/

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "djangocms-transfer",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Django CMS Association and contributors <info@django-cms.org>",
    "keywords": null,
    "author": null,
    "author_email": "Divio AG <info@divio.ch>",
    "download_url": "https://files.pythonhosted.org/packages/15/55/08a1a4686b691722f7c5d432f41f44f21c186cd203f9b852968c776effa5/djangocms_transfer-2.0.0.tar.gz",
    "platform": null,
    "description": "===================\ndjango CMS Transfer\n===================\n\n|pypi| |coverage| |python| |django| |djangocms|\n\n\n**django CMS Transfer** is an **experimental** package that allows you to export\nand import plugin data from a page or a placeholder. It does not support foreign\nkey relations and won't import/export related data, such as `media <https://github.com/django-cms/djangocms-transfer/issues/18>`_.\n\n.. note::\n\n        This project is endorsed by the `django CMS Association <https://www.django-cms.org/en/about-us/>`_.\n        That means that it is officially accepted by the dCA as being in line with our roadmap vision and development/plugin policy.\n        Join us on `Slack <https://www.django-cms.org/slack/>`_.\n\n.. image:: preview.gif\n\n\nDocumentation\n=============\n\nThe setting ``DJANGO_CMS_TRANSFER_SERIALIZER`` allows registration of a custom JSON serializer. An example use case would be subclassing Django's built-in Python serializer to base64-encode inline image data.\n\nSee ``REQUIREMENTS`` in the `setup.py <https://github.com/divio/djangocms-transfer/blob/master/setup.py>`_\nfile for additional dependencies:\n\n\n\nInstallation\n------------\n\nFor a manual install:\n\n* run ``pip install djangocms-transfer``\n* add ``djangocms_transfer`` to your ``INSTALLED_APPS``\n\n\nVersion Compatibility\n---------------------\n\nFor django CMS 4.0 or later, you must use djangocms-transfer 2.0 or later.\n\nFor django CMS 3.7 through 3.11 use versions 1.x of djangocms-transfer.\n\n\nHow to Use\n----------\n\nTo export/import a page, click on the \"*Page*\" menu on the toolbar\nand select your desired choice.\n\nTo export/import a plugin, Open the \"*Structure board*\", click on the\ndropdown menu for the specific plugin and select your choice.\n\n\nCustomization\n-------------\n\nFollowing settings are available:\n\n* **DJANGOCMS_TRANSFER_PROCESS_EXPORT_PLUGIN_DATA**:\n\n  Enables processing of plugin instances prior to serialization, e.g.\n  ``myapp.module.function``.\n\n* **DJANGOCMS_TRANSFER_PROCESS_IMPORT_PLUGIN_DATA**:\n\n  Enables processing of plugin instances prior to saving, e.g.\n  ``myapp.module.function``.\n  For example: set default-values for ForeignKeys (images for django_filer, ..)\n\nAs an example the combination of ``_PROCESS_EXPORT_PLUGIN_DATA`` and\n``_PROCESS_IMPORT_PLUGIN_DATA`` lets you export and import the data between\ndifferent systems while setting the contents as you need it::\n\n    # settings.py\n    .._PROCESS_EXPORT_PLUGIN_DATA = \"myapp.some.module.export_function\"\n    .._PROCESS_IMPORT_PLUGIN_DATA = \"myapp.some.module.import_function\"\n\n    # custom functions\n    def export_function(plugin, plugin_data):\n        # remove child-plugins which can't be handled\n        if plugin.parent_id and plugin.parent.plugin_type == \"SomeParentPlugin\":\n            return None\n        # change data\n        if plugin.plugin_type == \"SomePlugin\":\n            plugin_data[\"data\"].update({\n                \"some_field\": \"TODO: change me\",\n            })\n        return plugin_data\n\n    def import_function(deserialized_object):\n        some_related_object = MyModel.objects.first()\n        for field in deserialized_object.object._meta.fields:\n            # example of setting a default value for a related field\n            if isinstance(field, ForeignKey):\n                value = getattr(deserialized_object.object, field.attname)\n                if field.related_model == MyModel and value is not None:\n                    setattr(deserialized_object.object, field.name, some_related_object)\n\n\nRunning Tests\n-------------\n\nYou can run tests by executing::\n\n    python -m venv env\n    source env/bin/activate\n    pip install -r tests/requirements/dj51_cms41.txt\n    coverage run tests/settings.py\n\n\n*******************************************\nContribute to this project and win rewards\n*******************************************\n\nBecause this is an open-source project, we welcome everyone to\n`get involved in the project <https://www.django-cms.org/en/contribute/>`_ and\n`receive a reward <https://www.django-cms.org/en/bounty-program/>`_ for their contribution.\nBecome part of a fantastic community and help us make django CMS the best CMS in the world.\n\nWe'll be delighted to receive your\nfeedback in the form of issues and pull requests. Before submitting your\npull request, please review our `contribution guidelines\n<http://docs.django-cms.org/en/latest/contributing/index.html>`_.\n\nWe're grateful to all contributors who have helped create and maintain this package.\nContributors are listed at the `contributors <https://github.com/django-cms/djangocms-transfer/graphs/contributors>`_\nsection.\n\n\n.. |pypi| image:: https://badge.fury.io/py/djangocms-transfer.svg\n    :target: http://badge.fury.io/py/djangocms-transfer\n.. |coverage| image:: https://codecov.io/gh/django-cms/djangocms-transfer/branch/master/graph/badge.svg\n    :target: https://codecov.io/gh/django-cms/djangocms-transfer\n\n.. |python| image:: https://img.shields.io/badge/python-3.9+-blue.svg\n    :target: https://pypi.org/project/djangocms-transfer/\n.. |django| image:: https://img.shields.io/badge/django-4.2,%205.0,%205.1-blue.svg\n    :target: https://www.djangoproject.com/\n.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-4-blue.svg\n    :target: https://www.django-cms.org/\n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "Adds import and export of plugin data.",
    "version": "2.0.0",
    "project_urls": {
        "Homepage": "https://github.com/django-cms/djangocms-transfer"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a91ccc717baa23ca490892c98f864e8279c9c07f27a372f550e55913fce57f78",
                "md5": "736aca0c0afecfad7d601ccefbcd1405",
                "sha256": "15bf915d53123ec8f2d42163f55a47e681fed67b6cd5d97fa93440a4da661518"
            },
            "downloads": -1,
            "filename": "djangocms_transfer-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "736aca0c0afecfad7d601ccefbcd1405",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 15784,
            "upload_time": "2025-08-09T07:50:47",
            "upload_time_iso_8601": "2025-08-09T07:50:47.412838Z",
            "url": "https://files.pythonhosted.org/packages/a9/1c/cc717baa23ca490892c98f864e8279c9c07f27a372f550e55913fce57f78/djangocms_transfer-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "155508a1a4686b691722f7c5d432f41f44f21c186cd203f9b852968c776effa5",
                "md5": "86902e8a0c127c38f7ade7b136998d4f",
                "sha256": "90ebbf5411ebc98a9d7127d9cf87c785fee2c463db8e8ec060313d71af2d7fb1"
            },
            "downloads": -1,
            "filename": "djangocms_transfer-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "86902e8a0c127c38f7ade7b136998d4f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 15509,
            "upload_time": "2025-08-09T07:50:48",
            "upload_time_iso_8601": "2025-08-09T07:50:48.603676Z",
            "url": "https://files.pythonhosted.org/packages/15/55/08a1a4686b691722f7c5d432f41f44f21c186cd203f9b852968c776effa5/djangocms_transfer-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-09 07:50:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "django-cms",
    "github_project": "djangocms-transfer",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "tox": true,
    "lcname": "djangocms-transfer"
}
        
Elapsed time: 2.56247s