diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-21 20:28:02 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-01-21 20:28:02 +0100 |
commit | 8661870960701ba1ac7b52a867ed14d10acacf93 (patch) | |
tree | 5e230e6e9a775029ee560a92a4678064ae1a3ec4 /ishtar_common | |
parent | 9aa59d8ea96e19d472227ff6eefdefc929523700 (diff) | |
download | Ishtar-8661870960701ba1ac7b52a867ed14d10acacf93.tar.bz2 Ishtar-8661870960701ba1ac7b52a867ed14d10acacf93.zip |
Administrativ act: adapt forms, models and sheet
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 |