Commits

Ivan Zakrevsky committed ede0300

Fixed bug for new objects, with try

  • Participants
  • Parent commits e8ede9f

Comments (0)

Files changed (1)

versioning/signals.py

     """Pre-save signal handler
     """
     model = kwargs["sender"]
-    if instance.pk:
+    try:
         original = model._default_manager.get(pk=instance.pk)
-    else:
+    except model.DoesNotExist:
         original = model()
     delta = obj_diff(instance, original)
     info = getattr(instance, 'revision_info', {})