django-cms/djangocms-history

Provides undo/redo functionality for django CMS operations

addon
cms
django
django-cms
python

django CMS History

pypi coverage PyPI - Python Version PyPI - Django Versions from Framework Classifiers PyPI - django CMS Versions from Framework Classifiers

django CMS History is an addon application to provide undo/redo functionality in django CMS, by maintaining content history.

Some of the functionality in this application was previously included in django CMS itself. However, it became apparent that some users did not want it, and some wanted functionality that worked differently.

In keeping with the django CMS philosophy of maintaining only core CMS functionality as part of the package itself, history management was removed from django CMS in version 3.4 and has been spun off into an independent application.

django CMS History has been rewritten from the ground up. It will continue to be developed. New functionality and improvements will be introduced in future releases.

:::: note ::: title Note :::

This project is considered 3rd party (no supervision by the django CMS Association). Join us on Slack for more information. ::::

image

Contribute to this project and win rewards

Because this is a an open-source project, we welcome everyone to get involved in the project and receive a reward 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.

We\'re grateful to all contributors who have helped create and maintain this package. Contributors are listed at the contributors section.

Documentation

See REQUIREMENTS in the setup.py file for additional dependencies:

PyPI - Python Version PyPI - Django Versions from Framework Classifiers PyPI - django CMS Versions from Framework Classifiers

Version support

djangocms-history 3.x supports django CMS 4.1 and later. If you are using django CMS 3.x, use djangocms-history 2.x.

The supported Python, Django and django CMS versions are shown by the PyPI - Python Version, PyPI - Django Versions from Framework Classifiers and PyPI - django CMS Versions from Framework Classifiers badges at the top of this page (read directly from the published PyPI classifiers).

Installation

For a manual install:

  • run pip install djangocms-history
  • add djangocms_history to your INSTALLED_APPS
  • run python manage.py migrate djangocms_history

:::: warning ::: title Warning :::

Upgrading from djangocms-history 2.x: history records created with django CMS 3.x cannot be replayed against the plugin tree of django CMS 4 and later. All existing history records are deleted by the migrations of version 3.0. Since the undo window is 24 hours, this only affects operations performed right before the upgrade. ::::

Configuration

Once installed, django CMS History will make new options available to the web content manager. These will be visible in the django CMS toolbar when managing content that is supported by the application.

In-place updates

On django CMS 5.1 and later, undo and redo update the structure board in place (through the data bridge the endpoints return), preserving scroll position and board state. On earlier versions the page is reloaded after each undo/redo instead.

Retiring operations: archive or delete

Undo/redo is only available for a limited time (the last 24 hours). Once an operation falls out of that window or is superseded --- for example by an edit on another page, by another user, or by a new editing session --- it is retired from the undo/redo system and is never reconsidered again.

By default such operations are deleted outright, keeping the history tables small. If you would rather keep them (e.g. for auditing), enable archiving:

DJANGOCMS_HISTORY_ARCHIVE_OPERATIONS = True

Archived operations are flagged with is_archived=True and are still never used by undo/redo. To remove them later and reclaim database space, run:

python manage.py purge_archived_operations

The command supports --days N (only purge archived operations older than N days) and --dry-run (report what would be deleted without deleting).

djangocms-versioning

When djangocms-versioning is installed, undo/redo only operates on content that is editable, i.e. on draft versions. Once a version has been published, operations recorded on its draft can no longer be undone or redone; the toolbar buttons are disabled and the endpoints refuse to modify the published content.

Running Tests

The test suite uses pytest (with pytest-django). You can run tests by executing:

python -m venv env
source env/bin/activate
pip install -r tests/requirements/dj52_cms50.txt -e .
pytest

Run with djangocms-versioning installed:

pip install djangocms-versioning
VERSIONING=1 pytest
Stars
28
100.00% more than last month
Forks
12
Open Issues
3