django-cms / djangocms-history

Provides undo/redo functionality for django CMS operations
https://www.django-cms.org
Other
28 stars 13 forks source link

Error on undo changes in plugin with m2m fields defined #16

Closed jegorami closed 3 years ago

jegorami commented 6 years ago

Summary

When trying to redo changes in custom cms plugin that has m2m field defined, exception is raised:

Internal Server Error: /fi/admin/djangocms_history/placeholderoperation/undo/

File "venv/local/lib/python2.7/site-packages/djangocms_history/action_handlers.py", line 111, in undo_change_plugin plugin.model.objects.filter(pk=plugin.pk).update(**plugin.data) File "venv/local/lib/python2.7/site-packages/django/db/models/query.py", line 561, in update query.add_update_values(kwargs) File "venv/local/lib/python2.7/site-packages/django/db/models/sql/subqueries.py", line 128, in add_update_values 'foreign keys permitted).' % field FieldError: Cannot update model field (only non-relations and foreign keys permitted).

Expected behaviour

Plugin content is reverted

Actual behaviour

Exception is raised

Environment