过滤优化允许双下划线搜索内嵌字段
This commit is contained in:
parent
06c1d4f373
commit
447b8b265a
|
@ -170,7 +170,9 @@ class ListMixin(ModelViewBase):
|
|||
# 遍历视图定义的过滤字段集合
|
||||
for arg, operators in self.filter_fields:
|
||||
# 过滤参数不在字段列表中
|
||||
if arg not in all_fields:
|
||||
# 有可能是内嵌字段等,按双下划线切分查找
|
||||
pre_field = arg.split("__")[0]
|
||||
if pre_field not in all_fields:
|
||||
continue
|
||||
# get传递的参数值为空或不存在,忽略
|
||||
val = request.args.get(arg, "")
|
||||
|
|
Loading…
Reference in New Issue