Reversion working for training level

This commit is contained in:
2021-08-29 22:16:25 +01:00
parent 4a121964dc
commit de5997b9da
6 changed files with 23 additions and 5 deletions

View File

@@ -21,7 +21,6 @@ class FieldComparison(object):
def display_value(self, value):
if (isinstance(self.field, IntegerField) or isinstance(self.field, CharField)) and self.field.choices is not None and len(self.field.choices) > 0:
choice = [x[1] for x in self.field.choices if x[0] == value]
# TODO This defensive piece should not be necessary?
if len(choice) > 0:
return choice[0]
if isinstance(self.field, BooleanField):
@@ -122,7 +121,7 @@ class ModelComparison(object):
old_item_versions = self.version.parent.revision.version_set.exclude(content_type=item_type)
new_item_versions = self.version.revision.version_set.exclude(content_type=item_type).exclude(content_type=ContentType.objects.get_for_model(models.EventAuthorisation))
comparisonParams = {'excluded_keys': ['id', 'event', 'order', 'checklist']}
comparisonParams = {'excluded_keys': ['id', 'event', 'order', 'checklist', 'level']}
# Build some dicts of what we have
item_dict = {} # build a list of items, key is the item_pk