Metadata-Version: 2.1
Name: djangocms-export-page
Version: 0.1.1
Summary: Export a Django CMS page or a model view to a DOCX document
Home-page: https://github.com/maykinmedia/djangocms-export-page
Author: Maykin Media
Author-email: support@maykinmedia.nl
License: MIT
Keywords: django cms export docx
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.11
Classifier: Framework :: Django :: 2.0
Classifier: Framework :: Django :: 2.1
Classifier: Intended Audience :: Developers
Classifier: Operating System :: Unix
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: django-cms
Requires-Dist: djangocms-page-meta
Requires-Dist: python-docx
Provides-Extra: coverage
Requires-Dist: pytest-cov; extra == 'coverage'
Provides-Extra: docs
Requires-Dist: sphinx; extra == 'docs'
Requires-Dist: sphinx-rtd-theme; extra == 'docs'
Provides-Extra: pep8
Requires-Dist: flake8; extra == 'pep8'
Provides-Extra: release
Requires-Dist: zest.releaser; extra == 'release'
Provides-Extra: tests
Requires-Dist: pytest; extra == 'tests'
Requires-Dist: pytest-django; extra == 'tests'
Requires-Dist: tox; extra == 'tests'
Requires-Dist: isort; extra == 'tests'


Django CMS Export Page
=================================================

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

|build-status| |requirements| |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.4 or above
* setuptools 30.3.0 or above
* Django 1.11 or above
* Django CMS 3.4.6 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 ForeignKey that would behave like children,
add the following to the CMSPlugin model class:

.. code-block:: python

    _export_page = {
        'children': 'items'
    }

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', ... ]
    }


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 Placeholders
-------------------

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

.. code-block:: python

    EXPORT_STATIC_PLACEHOLDERS = {
        'template_name': ['static_placeholder_code']
    }

So with the cms settings it will look like this:

.. code-block:: python

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

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

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

.. |build-status| image:: https://travis-ci.org/maykinmedia/djangocms-export-page.svg?branch=develop
    :target: https://travis-ci.org/maykinmedia/djangocms-export-page

.. |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/


