Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace django-reversion by djangocms-history #234

Open
jrief opened this issue Apr 4, 2017 · 5 comments
Open

Replace django-reversion by djangocms-history #234

jrief opened this issue Apr 4, 2017 · 5 comments

Comments

@jrief
Copy link
Owner

jrief commented Apr 4, 2017

In django-cms reversion has been replaced by djangocms-history.
Therefore Cascade shall adopt to this change.

@haricot
Copy link
Contributor

haricot commented Mar 29, 2018

With this PR #281 it works in part, because with the plugins who have multiple pk in their description that's there is this error:

  File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 429, in undo
    _action_handlers[self.action]['undo'](self)
  File "/path/venv/lib/python3.6/site-packages/djangocms_history/action_handlers.py", line 82, in undo_add_plugin
    post_data = action.get_post_action_data()
  File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 425, in get_post_action_data
    return self._get_parsed_data(self.post_action_data)
  File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 417, in _get_parsed_data
    object_hook=self._object_version_data_hook,
  File "/usr/lib64/python3.6/json/__init__.py", line 367, in loads
    return cls(**kw).decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
  File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 411, in _object_version_data_hook
    return ArchivedPlugin(**data)
TypeError: __new__() got an unexpected keyword argument 'model'
[2018-03-29 11:04:21,965 basehttp] ERROR: "POST /admin/djangocms_history/placeholderoperation/undo/ HTTP/1.1" 500 8170
File "/path/venv/lib/python3.6/site-packages/djangocms_history/views.py", line 37, in post
   self.object.undo()
 File "/usr/lib64/python3.6/contextlib.py", line 52, in inner
   return func(*args, **kwds)
 File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 351, in undo
   action.undo()
 File "/usr/lib64/python3.6/contextlib.py", line 52, in inner
   return func(*args, **kwds)
 File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 429, in undo
   _action_handlers[self.action]['undo'](self)
 File "/path/venv/lib/python3.6/site-packages/djangocms_history/action_handlers.py", line 82, in undo_add_plugin
   post_data = action.get_post_action_data()
 File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 425, in get_post_action_data
   return self._get_parsed_data(self.post_action_data)
 File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 417, in _get_parsed_data
   object_hook=self._object_version_data_hook,
 File "/usr/lib64/python3.6/json/__init__.py", line 367, in loads
   return cls(**kw).decode(s)
 File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
   obj, end = self.raw_decode(s, idx=_w(s, 0).end())
 File "/usr/lib64/python3.6/json/decoder.py", line 355, in raw_decode
   obj, end = self.scan_once(s, idx)
 File "/path/venv/lib/python3.6/site-packages/djangocms_history/models.py", line 411, in _object_version_data_hook
   return ArchivedPlugin(**data)
TypeError: __new__() got an unexpected keyword argument 'type'

otherwise the other plugins works well with undo and redo.

@haricot
Copy link
Contributor

haricot commented Mar 30, 2018

Examples of content that have multiple pk generating the above errors :
{"parent_id": 307, "plugins": [{"pk": 322, "creation_date": "2018-03-30T09:52:19.780Z", "position": 4, "plugin_type": "BootstrapImagePlugin", "parent_id": 307, "data": {"glossary": {"hide_plugin": "", "image_title": "", "alt_tag": "", "target": "", "title": "", "image_shapes": ["img-responsive"], "image_width_responsive": "100%", "image_width_fixed": "", "image_height": "", "resize_options": ["subject_location", "high_resolution"], "link": {"type": "none"}, "image": {"pk": 50, "model": "filer.Image"}}, "shared_glossary": null}}], "order": []}

{"parent_id": 307, "plugins": [{"pk": 321, "creation_date": "2018-03-30T09:44:15.131Z", "position": 3, "plugin_type": "BootstrapButtonPlugin", "parent_id": 307, "data": {"glossary": {"hide_plugin": "", "button_type": "btn-primary", "button_size": "", "button_options": [], "quick_float": "", "target": "", "title": "", "icon_align": "", "icon_font": "", "symbol": "", "link": {"type": "cmspage", "model": "cms.Page", "pk": 1, "section": ""}, "link_content": "jio"}, "shared_glossary": null}}], "order": []}

@haricot
Copy link
Contributor

haricot commented Mar 30, 2018

By changing the line of djangocms_history/models.py#L403:
if data and 'pk' in data:
to
if data and 'pk' in data and 'model' not in data:

With this change and this PR #281, djangocms-cascade plugins work with djangocms-history.

@jrief
Copy link
Owner Author

jrief commented Mar 31, 2018

Many thank to @haricot for changing this. Unfortunately I had no time to fix this. Will check that PR soon.

@haricot
Copy link
Contributor

haricot commented Jun 30, 2019

djangocms-history and djangocms-transfer works since the commit d7e4d4c
if it suits you this may be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants