djangocms-export-page


Namedjangocms-export-page JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryExport a Django CMS page or a model view to a DOCX document
upload_time2024-12-16 16:13:29
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseCopyright {% now "Y" %} Maykin Media Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords django cms export docx
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
Django CMS Export Page
=================================================

:Version: 0.2.0
:Source: https://bitbucket.org/maykinmedia/djangocms-export-page
:Keywords: ``django`` ``cms`` ``export`` ``docx``
:PythonVersion: 3.11

|build-status| |code-quality| |black| |coverage|

|python-versions| |django-versions| |pypi-version|

Export a Django CMS page or a model view to a DOCX document

.. contents::

.. section-numbering::

Features
========

* Adds a menu entry in the CMS toolbar to export the current page
* Ability to export a custom model, including placeholder fields

.. image:: img/page-export-menu.png

Installation
============

Requirements
------------

* Python 3.11 or above
* Django 3.2 or above
* Django CMS 4.1 or above


Install
-------

.. code-block:: bash

    pip install djangocms-export-page


Usage
=====

In your Django settings:

.. code-block:: python

    INSTALLED_APPS = [
        ...
        'djangocms_export_page',
        ...
    ]



CMS Page
--------

CMS Page don't need any extra configuration to work.

If a Plugin has a reverse ForeignKey that would behave like children,
add the following to the CMSPlugin model class:

.. code-block:: python

    _export_page = {
        'children': 'items'
    }

    @property
    def items(self):
        return self.frequentlyaskedquestion_set.all()

where `items` is a iterable attribute of the model class.

And for on the ForeignKey Django model class:

.. code-block:: python

    _export_page = {
        'fields': ['name', ... ]
    }

If you want to export the contents of a ForeignKey or OneToOneField inside the regular model you can use
`_export_page_field_names`. Now these fields will be put in the some level as the plugin fields.

.. code-block:: python

    _export_page_field_names = ['number', 'title', 'lead', 'display_date', 'date', 'location']


Django Model
------------

If you need to export a Django model included in a AppHook,
add the following to the model class:

.. code-block:: python

    _export_page = {
        'sections': [{
            'name': 'Meta',
            'fields': ['title', ... ]
        }, {
            'name': 'Body',
            'fields': ['content']
        }],
    }

It's better to put the PlaceholderField (here `content`) in a separate section.


Static Aliases
-------------------

If you also want to export the static aliases of a page, some extra configuration
is required. There is a setting called `EXPORT_STATIC_ALIASES`.

.. code-block:: python

    EXPORT_STATIC_ALIASES = {
        'template_name': ['static_alias_code']
    }

So with the cms settings it will look like this:

.. code-block:: python

    # test.html
    <div>
        {% static_alias 'test-placeholder' %}
    </div>

    # settings.py
    CMS_TEMPLATES = [
        ('test.html', _('Test page')),
    ]

    EXPORT_STATIC_ALIASES = {
        'test.html': ['test-placeholder']
    }

.. |build-status| image:: https://github.com/maykinmedia/djangocms-export-page/workflows/Run%20CI/badge.svg
    :alt: Build status
    :target: https://github.com/maykinmedia/djangocms-export-page/actions?query=workflow%3A%22Run+CI%22

.. |requirements| image:: https://requires.io/github/maykinmedia/djangocms-export-page/requirements.svg?branch=develop
    :target: https://requires.io/github/maykinmedia/djangocms-export-page/requirements/?branch=develop
    :alt: Requirements status

.. |coverage| image:: https://codecov.io/gh/maykinmedia/djangocms-export-page/branch/develop/graph/badge.svg
    :target: https://codecov.io/gh/maykinmedia/djangocms-export-page
    :alt: Coverage status

.. |python-versions| image:: https://img.shields.io/pypi/pyversions/djangocms-export-page.svg

.. |django-versions| image:: https://img.shields.io/pypi/djversions/djangocms-export-page.svg

.. |pypi-version| image:: https://img.shields.io/pypi/v/djangocms-export-page.svg
    :target: https://pypi.org/project/djangocms-export-page/

.. |code-quality| image:: https://github.com/maykinmedia/djangocms-export-page/workflows/Code%20quality%20checks/badge.svg
     :alt: Code quality checks
     :target: https://github.com/maykinmedia/djangocms-export-page/actions?query=workflow%3A%22Code+quality+checks%22

.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "djangocms-export-page",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "django cms export docx",
    "author": null,
    "author_email": "Maykin Media <support@maykinmedia.nl>",
    "download_url": "https://files.pythonhosted.org/packages/8b/3a/eb47ed7d8f72e26256ebc3d71ab0ac405f8fb0e72f8d2480ff0bd64e6e87/djangocms_export_page-0.2.1.tar.gz",
    "platform": null,
    "description": "\nDjango CMS Export Page\n=================================================\n\n:Version: 0.2.0\n:Source: https://bitbucket.org/maykinmedia/djangocms-export-page\n:Keywords: ``django`` ``cms`` ``export`` ``docx``\n:PythonVersion: 3.11\n\n|build-status| |code-quality| |black| |coverage|\n\n|python-versions| |django-versions| |pypi-version|\n\nExport a Django CMS page or a model view to a DOCX document\n\n.. contents::\n\n.. section-numbering::\n\nFeatures\n========\n\n* Adds a menu entry in the CMS toolbar to export the current page\n* Ability to export a custom model, including placeholder fields\n\n.. image:: img/page-export-menu.png\n\nInstallation\n============\n\nRequirements\n------------\n\n* Python 3.11 or above\n* Django 3.2 or above\n* Django CMS 4.1 or above\n\n\nInstall\n-------\n\n.. code-block:: bash\n\n    pip install djangocms-export-page\n\n\nUsage\n=====\n\nIn your Django settings:\n\n.. code-block:: python\n\n    INSTALLED_APPS = [\n        ...\n        'djangocms_export_page',\n        ...\n    ]\n\n\n\nCMS Page\n--------\n\nCMS Page don't need any extra configuration to work.\n\nIf a Plugin has a reverse ForeignKey that would behave like children,\nadd the following to the CMSPlugin model class:\n\n.. code-block:: python\n\n    _export_page = {\n        'children': 'items'\n    }\n\n    @property\n    def items(self):\n        return self.frequentlyaskedquestion_set.all()\n\nwhere `items` is a iterable attribute of the model class.\n\nAnd for on the ForeignKey Django model class:\n\n.. code-block:: python\n\n    _export_page = {\n        'fields': ['name', ... ]\n    }\n\nIf you want to export the contents of a ForeignKey or OneToOneField inside the regular model you can use\n`_export_page_field_names`. Now these fields will be put in the some level as the plugin fields.\n\n.. code-block:: python\n\n    _export_page_field_names = ['number', 'title', 'lead', 'display_date', 'date', 'location']\n\n\nDjango Model\n------------\n\nIf you need to export a Django model included in a AppHook,\nadd the following to the model class:\n\n.. code-block:: python\n\n    _export_page = {\n        'sections': [{\n            'name': 'Meta',\n            'fields': ['title', ... ]\n        }, {\n            'name': 'Body',\n            'fields': ['content']\n        }],\n    }\n\nIt's better to put the PlaceholderField (here `content`) in a separate section.\n\n\nStatic Aliases\n-------------------\n\nIf you also want to export the static aliases of a page, some extra configuration\nis required. There is a setting called `EXPORT_STATIC_ALIASES`.\n\n.. code-block:: python\n\n    EXPORT_STATIC_ALIASES = {\n        'template_name': ['static_alias_code']\n    }\n\nSo with the cms settings it will look like this:\n\n.. code-block:: python\n\n    # test.html\n    <div>\n        {% static_alias 'test-placeholder' %}\n    </div>\n\n    # settings.py\n    CMS_TEMPLATES = [\n        ('test.html', _('Test page')),\n    ]\n\n    EXPORT_STATIC_ALIASES = {\n        'test.html': ['test-placeholder']\n    }\n\n.. |build-status| image:: https://github.com/maykinmedia/djangocms-export-page/workflows/Run%20CI/badge.svg\n    :alt: Build status\n    :target: https://github.com/maykinmedia/djangocms-export-page/actions?query=workflow%3A%22Run+CI%22\n\n.. |requirements| image:: https://requires.io/github/maykinmedia/djangocms-export-page/requirements.svg?branch=develop\n    :target: https://requires.io/github/maykinmedia/djangocms-export-page/requirements/?branch=develop\n    :alt: Requirements status\n\n.. |coverage| image:: https://codecov.io/gh/maykinmedia/djangocms-export-page/branch/develop/graph/badge.svg\n    :target: https://codecov.io/gh/maykinmedia/djangocms-export-page\n    :alt: Coverage status\n\n.. |python-versions| image:: https://img.shields.io/pypi/pyversions/djangocms-export-page.svg\n\n.. |django-versions| image:: https://img.shields.io/pypi/djversions/djangocms-export-page.svg\n\n.. |pypi-version| image:: https://img.shields.io/pypi/v/djangocms-export-page.svg\n    :target: https://pypi.org/project/djangocms-export-page/\n\n.. |code-quality| image:: https://github.com/maykinmedia/djangocms-export-page/workflows/Code%20quality%20checks/badge.svg\n     :alt: Code quality checks\n     :target: https://github.com/maykinmedia/djangocms-export-page/actions?query=workflow%3A%22Code+quality+checks%22\n\n.. |black| image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n",
    "bugtrack_url": null,
    "license": "Copyright {% now \"Y\" %} Maykin Media  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Export a Django CMS page or a model view to a DOCX document",
    "version": "0.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/maykinmedia/djangocms_export_page/issues",
        "Documentation": "http://djangocms_export_page.readthedocs.io/en/latest/",
        "Homepage": "https://github.com/maykinmedia/djangocms_export_page",
        "Source Code": "https://github.com/maykinmedia/djangocms_export_page"
    },
    "split_keywords": [
        "django",
        "cms",
        "export",
        "docx"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6b7d18da066b9c8e0bda27d98f3aaa62e54942aa3885c12dd3ed61e3cad7dcd5",
                "md5": "62829ceae4fc780a5ffca73d20995b70",
                "sha256": "32674e023242cc5e7badd111993562986f8e6c275c1427849b202d69dfd91d77"
            },
            "downloads": -1,
            "filename": "djangocms_export_page-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "62829ceae4fc780a5ffca73d20995b70",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 14366,
            "upload_time": "2024-12-16T16:13:24",
            "upload_time_iso_8601": "2024-12-16T16:13:24.854055Z",
            "url": "https://files.pythonhosted.org/packages/6b/7d/18da066b9c8e0bda27d98f3aaa62e54942aa3885c12dd3ed61e3cad7dcd5/djangocms_export_page-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8b3aeb47ed7d8f72e26256ebc3d71ab0ac405f8fb0e72f8d2480ff0bd64e6e87",
                "md5": "f81435649b27eef931ab4f4590e16323",
                "sha256": "b173f3b0d230ce86e5136d133208b14fa9c2b45d9c338102028088f3384c32c4"
            },
            "downloads": -1,
            "filename": "djangocms_export_page-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "f81435649b27eef931ab4f4590e16323",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 16435,
            "upload_time": "2024-12-16T16:13:29",
            "upload_time_iso_8601": "2024-12-16T16:13:29.030395Z",
            "url": "https://files.pythonhosted.org/packages/8b/3a/eb47ed7d8f72e26256ebc3d71ab0ac405f8fb0e72f8d2480ff0bd64e6e87/djangocms_export_page-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 16:13:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "maykinmedia",
    "github_project": "djangocms_export_page",
    "github_not_found": true,
    "lcname": "djangocms-export-page"
}
        
Elapsed time: 0.48357s