diff options
-rw-r--r-- | ishtar_common/models.py | 4 | ||||
-rw-r--r-- | ishtar_common/utils.py | 1 |
2 files changed, 2 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 06d706cdd..083da4cff 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1572,6 +1572,7 @@ class FullSearch(models.Model): search_vectors.append(row[0]) new_search_vector = merge_tsvectors(search_vectors) changed = old_search != new_search_vector + self.search_vector = new_search_vector if save and changed: self.__class__.objects.filter(pk=self.pk).update( search_vector=new_search_vector) @@ -3217,9 +3218,6 @@ class Town(Imported, models.Model): return res def __str__(self): - if self.cached_label: - return self.cached_label - self.save() return self.cached_label @property diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 9bd81383f..afb573da3 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -417,6 +417,7 @@ def _cached_label_changed(sender, **kwargs): lbl = getattr(instance, '_generate_' + cached_label)() if lbl != getattr(instance, cached_label): changed.append((cached_label, lbl)) + setattr(instance, cached_label, lbl) # update for cache if changed: instance._search_updated = False if hasattr(instance, '_cascade_change') and instance._cascade_change: |