diff options
Diffstat (limited to 'ishtar_common/models_common.py')
-rw-r--r-- | ishtar_common/models_common.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index e749580f4..19d04ea17 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -1133,7 +1133,8 @@ class FullSearch(models.Model): m2m_search_vector.key, config=m2m_search_vector.language ) ).values("search") - search_vectors.append(q.all()[0]["search"]) + if q.count(): + search_vectors.append(q.all()[0]["search"]) # int/float are not well managed by the SearchVector for int_search_vector in self.INT_SEARCH_VECTORS: @@ -1950,6 +1951,16 @@ class BaseHistorizedItem( self.fix_associated() return True + def no_post_process(self, history=False): + if not history: + self.skip_history_when_saving = True + self._cached_label_checked = True + self._post_saved_geo = True + self._external_id_checked = True + self._search_updated = True + self._no_move = True + self._no_down_model_update = True + class LightHistorizedItem(BaseHistorizedItem): history_date = models.DateTimeField(default=datetime.datetime.now) @@ -3440,15 +3451,6 @@ class MainItem(ShortMenuItem, SerializeItem, SheetItem): if hasattr(item, "main_geodata"): item.post_save_geo() - def no_post_process(self): - self.skip_history_when_saving = True - self._cached_label_checked = True - self._post_saved_geo = True - self._external_id_checked = True - self._search_updated = True - self._no_move = True - self._no_down_model_update = True - @classmethod def app_label(cls): return cls._meta.app_label |