diff options
Diffstat (limited to 'ishtar_common')
-rw-r--r-- | ishtar_common/models.py | 4 | ||||
-rw-r--r-- | ishtar_common/utils.py | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index eb84f8a7e..3af92a39e 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1030,6 +1030,10 @@ class FullSearch(models.Model): :param save: True if you want to save the object immediately :return: True if modified """ + if not self.pk: + logger.warning("Cannot update search vector before save or " + "after deletion.") + return if not self.BASE_SEARCH_VECTORS and not self.M2M_SEARCH_VECTORS \ and not self.INT_SEARCH_VECTORS \ and not self.PARENT_SEARCH_VECTORS: diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 4ecddfc92..23020ac95 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -129,11 +129,11 @@ def cached_label_changed(sender, **kwargs): if hasattr(instance, '_cascade_change') and instance._cascade_change: instance.skip_history_when_saving = True instance.save() - if hasattr(instance, 'update_search_vector'): - instance.update_search_vector() updated = False + if hasattr(instance, 'update_search_vector'): + updated = instance.update_search_vector() if hasattr(instance, '_cached_labels_bulk_update'): - updated = instance._cached_labels_bulk_update() + updated = instance._cached_labels_bulk_update() or updated if not updated and hasattr(instance, '_get_associated_cached_labels'): for item in instance._get_associated_cached_labels(): item._cascade_change = True |