mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-27 23:37:08 +00:00
perf: 优化 json field re 报错问题
This commit is contained in:
parent
3e9bafadec
commit
58edf02179
@ -378,9 +378,16 @@ class RelatedManager:
|
||||
|
||||
if match == 'ip_in':
|
||||
q = cls.get_ip_in_q(name, val)
|
||||
elif match in ("exact", "contains", "startswith", "endswith", "regex", "gte", "lte", "gt", "lt"):
|
||||
elif match in ("exact", "contains", "startswith", "endswith", "gte", "lte", "gt", "lt"):
|
||||
lookup = "{}__{}".format(name, match)
|
||||
q = Q(**{lookup: val})
|
||||
elif match == 'regex':
|
||||
try:
|
||||
re.compile(val)
|
||||
lookup = "{}__{}".format(name, match)
|
||||
q = Q(**{lookup: val})
|
||||
except re.error:
|
||||
q = ~Q()
|
||||
elif match == "not":
|
||||
q = ~Q(**{name: val})
|
||||
elif match in ['m2m', 'in']:
|
||||
|
Loading…
Reference in New Issue
Block a user