summaryrefslogtreecommitdiff
path: root/ishtar_common/views_item.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-18 13:06:19 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2023-01-18 13:06:19 +0100
commit1bf3057494bf80f1e6ad41718006b7f025c67a8a (patch)
tree51939709a38a80d41eb3e96064b0f8903c2183c3 /ishtar_common/views_item.py
parentd1aedd5981d6dc0e2262dba67f5eddb68e5de2b3 (diff)
downloadIshtar-1bf3057494bf80f1e6ad41718006b7f025c67a8a.tar.bz2
Ishtar-1bf3057494bf80f1e6ad41718006b7f025c67a8a.zip
WIP fix search (refs #5196)
Diffstat (limited to 'ishtar_common/views_item.py')
-rw-r--r--ishtar_common/views_item.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 4247e224a..821a6635f 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -1159,11 +1159,17 @@ def _manage_clean_search_field(dct, exclude=None):
if "*" not in dct[k] or not k.endswith("__iexact"):
continue
value = dct.pop(k).strip()
+ base_key = k[:-len("__iexact")]
+ if value == "*":
+ dct[base_key + "__isnull"] = False
+ # TODO search
+ #if exclude is not None:
+ # exclude[base_key + "__exact"] = ""
+ continue
if value.startswith("*"):
value = value[1:]
if value.endswith("*"):
value = value[:-1]
- base_key = k[: -len("__iexact")]
if value:
dct[base_key + "__icontains"] = value
elif exclude is not None:
@@ -2052,8 +2058,11 @@ def get_item(
if "exc_and_reqs" in dct:
exc_and_reqs += dct.pop("exc_and_reqs")
- _manage_clean_search_field(dct, excluded_dct)
+ updated_excluded = {}
+ _manage_clean_search_field(dct, updated_excluded)
_manage_clean_search_field(excluded_dct, dct)
+ if updated_excluded:
+ excluded_dct.update(updated_excluded)
query = _construct_query(relation_types, dct, or_reqs, and_reqs)
exc_query = None