diff --git a/reversion/models.py b/reversion/models.py index 45767cd2..f93a34d0 100644 --- a/reversion/models.py +++ b/reversion/models.py @@ -1,5 +1,6 @@ from collections import defaultdict from itertools import chain, groupby +import logging import django from django.apps import apps @@ -22,6 +23,9 @@ _get_content_type, _get_options) +logger = logging.getLogger(__name__) + + def _safe_revert(versions): unreverted_versions = [] for version in versions: @@ -29,6 +33,7 @@ def _safe_revert(versions): with transaction.atomic(using=version.db): version.revert() except (IntegrityError, ObjectDoesNotExist): + logger.warning('Could not revert to {version}', exc_info=True) unreverted_versions.append(version) if len(unreverted_versions) == len(versions): raise RevertError(gettext("Could not save %(object_repr)s version - missing dependency.") % {