Skip to main content

Import/Export for Wagtail CMS pages, images and documents.

Project description

wagtail-import-export-updated

Import/Export for Wagtail CMS pages, images, and documents from CSV, JSON, and API. Forked and updated for usability with new versions of Django/Wagtail, as the original library from Torchbox has not been edited since Apr 2019. Improvements in functionality, performance, documentation, views, etc will be published time after time.

A published page and its published descendants can be exported via API or file from a source site and imported into a destination site under an existing page.

The destination site should have the same page models as the source site, with compatible migrations.

Installation

pip install wagtail-import-export-updated

Now add to your project's INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    'wagtailimportexport',
    # ...
]

Add the following to your project's urls.py (note that the include(wagtailimportexport_urls) line must appear above the include(wagtail_urls) line that defines Wagtail's default routes):

from wagtailimportexport import urls as wagtailimportexport_urls

urlpatterns = [
    # ...
    url(r'', include(wagtailimportexport_urls)),
    url(r'', include(wagtail_urls)),
]

(wagtailimportexport.urls contains the export API endpoint. The admin urls are in wagtailimportexport.admin_urls and are automatically registered.)

You should now see an 'Import / Export' item in the Wagtail admin menu.

Configuration

When importing via the API, only published pages are exported by default. If a descendant page is unpublished it and all its descendants are pruned (even if some of those descendants are themselves published).

It is possible to export all pages under a source page by adding a setting on the source site:

WAGTAILIMPORTEXPORT_EXPORT_UNPUBLISHED = True

This should not be used in a public source site because the API is unauthenticated and would thus expose unpublished content to anyone.

Limitations

If the imported content includes any foreign keys to page models, these will be updated to reflect the new page IDs if the target page is also part of the import, or left unchanged otherwise. If the target page is neither part of the import nor does it already exist on the destination site, this is likely to fail with a database integrity error.

Page references within rich text or StreamField content will not be rewritten to reflect new page IDs.

Imports are processed in tree path order; first the base Page records are imported, followed by the data for specific page subclasses. If a model is imported which includes a foreign key to a specific subclass of Page, and the target page of that foreign key appears in the import but later in tree path order, this will fail with an integrity error (as the relevant record will not have been created at that point).

Non-page data, such as images, documents or snippets, is not included in the import; the user is responsible for ensuring that any objects referenced from imported pages are already present on the destination site (with matching IDs).

Credits

This project is based on torchbox/wagtail-import-export. Because they use the same Django application name, both cannot be used on the same project at the same time.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail-import-export-updated-0.1.5.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file wagtail-import-export-updated-0.1.5.tar.gz.

File metadata

File hashes

Hashes for wagtail-import-export-updated-0.1.5.tar.gz
Algorithm Hash digest
SHA256 447c734a870e363205a00bfbbefabd853e99cc92632c10b120d0d0e83b2c7a6d
MD5 7e050decfd59b1c03445d7256c570222
BLAKE2b-256 c3a30226746bb3ef94b4e1586ff740aab7104b41f75f6af933cf3ebd7ccf677a

See more details on using hashes here.

File details

Details for the file wagtail_import_export_updated-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_import_export_updated-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 765a0dafd97698dadde0093251e285592d1c61da813f994c0ad815572465d593
MD5 161ed8cf514b56a2d5d4eb586836cb6c
BLAKE2b-256 2d30afa4da7e9f5467ffcaeb15ee983c3ddf4cafc9423c48564c33ae7ad75586

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page