summaryrefslogtreecommitdiff
path: root/ishtar_common/views_item.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/views_item.py')
-rw-r--r--ishtar_common/views_item.py20
1 files changed, 11 insertions, 9 deletions
diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py
index 53c65c3aa..93ab133a0 100644
--- a/ishtar_common/views_item.py
+++ b/ishtar_common/views_item.py
@@ -499,15 +499,17 @@ def _parse_query_string(string, query_parameters, current_dct, exc_dct,
if len(string) != 1:
for reserved_char in RESERVED_CHAR:
string = string.replace(reserved_char, u"")
- # like search
if string.endswith(u'*'):
if len(string.strip()) == 1:
return u""
- string = string[:-1] + u':*'
- if string.startswith(u'-'):
+ string = string[:-1] + ':*'
+ elif string not in ("&", "|", "!", "-"):
+ # like search by default
+ string = string + ':*'
+ if string.startswith('-'):
if len(string.strip()) == 1:
- return u""
- string = u"!" + string[1:]
+ return ""
+ string = "!" + string[1:]
return string
@@ -874,9 +876,9 @@ def _manage_hierarchic_fields(dct, and_reqs):
if val.endswith(u'"') and val.startswith(u'"'):
val = val[1:-1]
# manage search text by label
- if u"*" in val:
+ if "*" in val:
suffix = "label__icontains"
- val = val.replace(u'*', u"")
+ val = val.replace('*', u"")
else:
suffix = "label__iexact"
req = req[:-(len(base_suffix))] + suffix
@@ -902,9 +904,9 @@ def _manage_clean_search_field(dct):
dct[k] = _clean_type_val(dct[k])
if '*' in dct[k] and k.endswith('__iexact'):
value = dct.pop(k).strip()
- if value.startswith(u"*"):
+ if value.startswith("*"):
value = value[1:]
- if value.endswith(u"*"):
+ if value.endswith("*"):
value = value[:-1]
dct[k[:-len('__iexact')] + '__icontains'] = value