diff --git a/RIGS/templates/RIGS/activity_feed.html b/RIGS/templates/RIGS/activity_feed.html index a69938e8..273c72b9 100644 --- a/RIGS/templates/RIGS/activity_feed.html +++ b/RIGS/templates/RIGS/activity_feed.html @@ -87,7 +87,7 @@ {% endif %} - {% include 'RIGS/object_button.html' with object=version.current %} + {% include 'RIGS/object_button.html' with object=version.new %} diff --git a/RIGS/templates/RIGS/activity_table.html b/RIGS/templates/RIGS/activity_table.html index 0259e264..bf625e44 100644 --- a/RIGS/templates/RIGS/activity_table.html +++ b/RIGS/templates/RIGS/activity_table.html @@ -66,7 +66,7 @@ {{ version.revision.date_created }} - {{version.current|to_class_name}} {{ version.new.pk|stringformat:"05d" }} + {{version.new|to_class_name}} {{ version.new.pk|stringformat:"05d" }} {{ version.version.pk }}|{{ version.revision.pk }} {{ version.revision.user.name }} diff --git a/RIGS/versioning.py b/RIGS/versioning.py index 43eec7ea..6f7458d1 100644 --- a/RIGS/versioning.py +++ b/RIGS/versioning.py @@ -41,12 +41,13 @@ def model_compare(oldObj, newObj, excluded_keys=[]): for thisField in theFields: name = thisField.name - oldValue = getattr(oldObj, name, None) - newValue = getattr(newObj, name, None) - + if name in excluded_keys: continue # if we're excluding this field, skip over it + oldValue = getattr(oldObj, name, None) + newValue = getattr(newObj, name, None) + try: bothBlank = (not oldValue) and (not newValue) if oldValue != newValue and not bothBlank: @@ -129,7 +130,7 @@ def get_changes_for_version(newVersion, oldVersion=None): compare = {} compare['revision'] = newVersion.revision compare['new'] = newVersion.object_version.object - compare['current'] = modelClass.objects.get(pk=compare['new'].pk) + compare['current'] = modelClass.objects.filter(pk=compare['new'].pk).first() compare['version'] = newVersion if oldVersion: