Giter VIP home page Giter VIP logo

djangocms-reversion2's Introduction

Django-CMS Reversion2

Documentation Status

Code analysis status

Features

These are the core features of Django-CMS Reversion2

Create versions of pages

Create PageVersion: Revisions for page drafts in given language (only if changes were made see dirty flag)

image

View differences between versions of a page

Compare the current page with back-up versions.

image

Revert a page to a version

Revert to PageVersion: Reverting to any previous revision of page

image

Create a version for all 'unversioned' pages

Trash bin: Moves deleted pages to a hidden PageRoot before really deleting it

image

Multiple editors

Experimental feature. All page version can be edited. Work on the hidden drafts of PageVersion in order to realize multi-editor workflow??

image

Trash bin for pages

Trash bin: Moves deleted pages to a hidden PageRoot before really deleting it

image

Permission system

This plugin integrates with the django-cms permissions.

ToDos

To be implemented (see Issues on Github https://github.com/Blueshoe/djangocms-reversion2/issues)
  • Auto-Revisions when reverting from unsaved drafts
  • Integration with divio/djangocms_moderation once they publish a stable release
  • Build a multi-editor djangocms_toolbar and disable buttons that make unwanted changes

Disclaimer

This is an experimental plugin.

No software is perfect, everyone's code sucks. Feel free to suggest, criticize and/or contribute.

djangocms-reversion2's People

Contributors

danielpollithy avatar dietmar avatar mammuth avatar peterw-lwl avatar schille avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

djangocms-reversion2's Issues

Add attributes to PageVersion

  • was_published: whether this PageVersion was published once
  • backup_id: using the batch-add to create a 'backup'. If you want to roll back: select all PageVersions by backup (introduce a new backup-model?)
  • version_owner: the creator of the PageVersion (for the rights management)

auto saves

1/2 Lost changes

Problem: Reverting to a PageVersion with unsaved Changes.
Solution: Show an alert box with the button to create a PageVersion

2/2 Roll back to published page

Problem: Published pages are not automatically versioned
Solution: auto-create a version when publishing

Download trail as CSV

The audit trail should be downloadable as follows

Revision | Date | Author | Comment | Html diff

Consolidate Page marking

In order to unmark Page-language combinations as currently revised, a mixture of signal receivers and PageAdmin hooks is used. There are arguments for both:

On the one hand, to the best of my knowledge, the PageAdmin method post_plugin_move is the only way to hook into moving a CMSPlugin because that action never calls save(), but uses QuerySet.update(...) instead which does not send a signal.

On the other hand, listening to signals makes the marking/unmarking feature much easier to test.

Ultimately, I think it is desirable to have it all in one place if possible.

wheel

make the plugin in pre-stable installable via pypi

UI in diff view

  • A back button is missing
  • the apply revision button should be added to the diff view

Bin Basket faulty behaviour

When a page is dragged out of a basket in the bin, the basket is not detected as bin basket and therefore misses the trash icon

Diff view improving

The diff view shows the difference between the current Page draft and a Revision of that Page. This view is very (too) simple a this point, displaying plain text HTML with marked insertions/deletions based on diff-match-patch.

Any visual enhancement of this view, e.g. rendering of the diffed HTML, will be greatly welcome!

DjangoCMS 3.5 compatibility

Some fixes but still need work

diff --git a/djangocms_reversion2/admin.py b/djangocms_reversion2/admin.py
index 49a250f..65289e8 100644
--- a/djangocms_reversion2/admin.py
+++ b/djangocms_reversion2/admin.py
@@ -8,7 +8,8 @@ from cms import api, constants
 from cms.admin.pageadmin import PageAdmin
 from cms.middleware.page import get_page
 from cms.models import Page, Title, EmptyTitle
-from cms.utils import get_cms_setting, get_language_from_request, get_language_list, i18n
+from cms.utils.conf import get_cms_setting
+from cms.utils import get_language_from_request, get_language_list, i18n
 from cms.utils import page_permissions
 from collections import defaultdict
 
@@ -671,4 +672,4 @@ def render_admin_rows(request, pages, site, filtered=False, language=None):
     rendered = (render_page_row(page) for page in pages)
     return ''.join(rendered)
 
-admin.site.register(Page, PageAdmin2)
\ No newline at end of file
+admin.site.register(Page, PageAdmin2)
diff --git a/djangocms_reversion2/utils.py b/djangocms_reversion2/utils.py
index 20d91c5..b1a6777 100644
--- a/djangocms_reversion2/utils.py
+++ b/djangocms_reversion2/utils.py
@@ -55,7 +55,7 @@ def _copy_model(instance, **attrs):
 
 def get_version_page_root(site):
     try:
-        return Page.objects.get(title_set__title=VERSION_ROOT_TITLE, site=site)
+        return Page.objects.get(title_set__title=VERSION_ROOT_TITLE).filter(node__site==site)
     except Page.DoesNotExist:
         return api.create_page(
             VERSION_ROOT_TITLE, constants.TEMPLATE_INHERITANCE_MAGIC, settings.LANGUAGES[0][0], site=site)
  File "/home/www/django/home-page-cms/djangocms_reversion2/utils.py", line 218, in is_version_page
    return page.is_descendant_of(version_page_root)
AttributeError: 'Page' object has no attribute 'is_descendant_of'

Internationalization

The plugin should use django's internationalization (German translation needed)

Custom registration

Currently, django-cms registers all subclasses of CMSPlugin with the registry of django-reversion. This default registration's follow option does not include a 'cmsplugin_ptr', which is why we currently add this to the existing registration options for each CMSPlugin subclass.

It would be desirable to have a custom registration for djangocms-reversion2 which allows cms-plugin developers to register their cms-plugins with custom options that can override or be merged with the existing registration options.

Otherwise, custom relations cannot be properly versioned.

Preview PageVersion

If you click on the view button of a PageVersion in the diff-view, an iframe loads the url of a the hidden_page of the PageVersion.

  1. rights management: who can view the page
  2. hide the menubar with css instead of javascript: element.remove()

rights management

User:

  • can create PageVersion
  • can view own PageVersion
  • can view all PageVersion
  • can add PageVersion
  • can revert Page to PageVersion

Improve admin frontend

The PageRevision admin views are currently added as modal items to the django-cms toolbar. These admin views are very rudimental and should be improved both visually and functionally:

  • there is no way to get back from the diff view to the list view
  • there is no warning when reverting to a PageRevision: what changes will take effect, what objects may be lost, etc.
  • etc.

settings

make everything configurable!

Developer documentation

This project needs documentation for developers:

  • explaining the core concepts
  • how to use the page_revisions api

backup

  1. Create a backup model
  2. connect all PageVersions created by one batch-add
  3. batch-revert

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.