diff options
Diffstat (limited to 'archaeological_finds')
-rw-r--r-- | archaeological_finds/models.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py index 016bf4d45..5799d0e9a 100644 --- a/archaeological_finds/models.py +++ b/archaeological_finds/models.py @@ -645,6 +645,7 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): super(Find, self).save(*args, **kwargs) updated = False + self.skip_history_when_saving = True if not self.external_id or self.auto_external_id: external_id = get_external_id('find_external_id', self) if external_id != self.external_id: @@ -678,19 +679,16 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem): modified = True base_find.index = BaseFind.get_max_index( base_find.context_record.operation) + 1 - if not base_find.cache_short_id or \ - not base_find.cache_short_id.endswith( - unicode(base_find.index)): - base_find.cache_short_id = base_find.short_id() - if base_find.cache_short_id: - modified = True - if not base_find.cache_complete_id or \ - not base_find.cache_complete_id.endswith( - unicode(base_find.index)): - base_find.cache_complete_id = base_find.complete_id() - if base_find.cache_complete_id: - modified = True + short_id = base_find.short_id() + if base_find.cache_short_id != short_id: + base_find.cache_short_id = short_id + modified = True + complete_id = base_find.complete_id() + if base_find.cache_complete_id != complete_id: + base_find.cache_complete_id = complete_id + modified = True if modified: + base_find.skip_history_when_saving = True base_find.save() # if not base_find.material_index: # idx = BaseFind.objects\ |