Skip to content

Commit

Permalink
FIX #537: recent changes 500 server error
Browse files Browse the repository at this point in the history
Bloody *hell* that was hard to track down. Looks like there's somehow versioning data for eventchecklistcrew and eventchecklistvehicle hanging around which the included patch skips over for...reasons. I don't know why it works, why it ever worked before, or much of anything really. Send it.
  • Loading branch information
FreneticScribbler committed Jun 28, 2023
1 parent 2049d0f commit 9f4cd41
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions versioning/versioning.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def fields_changed(self):

@cached_property
def item_changes(self):
from RIGS.models import EventAuthorisation
from training.models import TrainingLevelQualification, TrainingItemQualification
if self.follow and self.version.object is not None:
from RIGS.models import EventAuthorisation
from training.models import TrainingLevelQualification, TrainingItemQualification
item_type = ContentType.objects.get_for_model(self.version.object)
old_item_versions = self.version.parent.revision.version_set.exclude(content_type=item_type).exclude(content_type=ContentType.objects.get_for_model(TrainingItemQualification)) \
.exclude(content_type=ContentType.objects.get_for_model(TrainingLevelQualification))
Expand All @@ -160,9 +160,11 @@ def item_changes(self):

# Build some dicts of what we have
item_dict = {} # build a list of items, key is the item_pk
if len(new_item_versions) is 0:
return None
for version in old_item_versions: # put all the old versions in a list
if version is None or version._object_version is None:
logging.warning(f"Something was null when it really shouldn't be! {old_item_versions}")
if version is None or version.object is None:
continue
compare = ModelComparison(old=version._object_version.object, **comparisonParams)
item_dict[version.object_id] = compare

Expand Down

0 comments on commit 9f4cd41

Please sign in to comment.