From ab46003c16996930fafbaa7b47d661c60976b82c Mon Sep 17 00:00:00 2001
From: Bryan Brancotte <bryan.brancotte@pasteur.fr>
Date: Fri, 13 Jan 2023 12:45:35 +0100
Subject: [PATCH] when AUTO_UPDATE_ENABLED is not enabled, make the index as
 needed to be rebuilt

---
 autocomplete_multi_models/signals.py | 4 +++-
 setup.cfg                            | 2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/autocomplete_multi_models/signals.py b/autocomplete_multi_models/signals.py
index 6f9ff42..189759a 100644
--- a/autocomplete_multi_models/signals.py
+++ b/autocomplete_multi_models/signals.py
@@ -2,8 +2,10 @@ from autocomplete_multi_models import business_process, utils
 
 
 def instance_update(sender, instance, field_names, **kwargs):
-    if business_process.get_setting_from_storage(utils.AUTO_UPDATE_ENABLED, True):
+    if business_process.get_setting_from_storage(utils.AUTO_UPDATE_ENABLED, "True") == "True":
         business_process.add_instance_to_index(instance, field_names)
+    else:
+        business_process.set_setting_in_storage(utils.REBUILD_NEEDED, True)
 
 
 def instance_delete(sender, instance, field_names, **kwargs):
diff --git a/setup.cfg b/setup.cfg
index 18eec64..e76e3de 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [metadata]
 name = autocomplete-multi-models
-version = 0.5
+version = 0.5.1
 description = An app that index fields across multiple models, and expose an api to query for word similar to the query.
 long_description = file: README.md
 author = Bryan Brancotte
-- 
GitLab