Skip to content

Commit

Permalink
When the brick for search configuration create automatically a config…
Browse files Browse the repository at this point in the history
…uration 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).
  • Loading branch information
genglert committed Apr 18, 2023
1 parent f318c8e commit bef99c6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion creme/creme_config/bricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit bef99c6

Please sign in to comment.