From bef99c640743b4a30de28a18b3f7a1c6023b449c Mon Sep 17 00:00:00 2001 From: Guillaume Englert Date: Mon, 17 Apr 2023 17:53:18 +0200 Subject: [PATCH] When the brick for search configuration create automatically a configuration for a model, this configuration is disabled. It avoid using all fields when you forget to create a configuration for a model which is not important to search (& so getting a potential slow search). --- creme/creme_config/bricks.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/creme/creme_config/bricks.py b/creme/creme_config/bricks.py index 00e5e17aff..65a3b5a38d 100644 --- a/creme/creme_config/bricks.py +++ b/creme/creme_config/bricks.py @@ -1035,7 +1035,14 @@ def __init__(this, ctype): ) if not sc_items or not sc_items[0].is_default: # No default config -> we build it - SearchConfigItem.objects.create(content_type=ctype) + # SearchConfigItem.objects.create(content_type=ctype) + logger.warning( + 'No search config for model <%s>; we create a disabled one.', + ctype, + ) + ctw.sc_items = [ + SearchConfigItem.objects.create(content_type=ctype, disabled=True), + ] return self._render(btc)