From 508c15528d8067842139d8cc414c19cf153946bc Mon Sep 17 00:00:00 2001 From: cheynechen Date: Sun, 29 Sep 2024 18:01:34 +0800 Subject: [PATCH] =?UTF-8?q?=20feat:=20IAM=E5=8F=8D=E5=90=91=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E9=A1=B9=E7=9B=AE=E8=B5=84=E6=BA=90=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E6=8C=89=E5=90=8D=E7=A7=B0=E6=9F=A5=E8=AF=A2=20--story=3D11972?= =?UTF-8?q?6965?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- itsm/auth_iam/resources/project.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/itsm/auth_iam/resources/project.py b/itsm/auth_iam/resources/project.py index c7eb18327..0eca65346 100644 --- a/itsm/auth_iam/resources/project.py +++ b/itsm/auth_iam/resources/project.py @@ -63,9 +63,11 @@ def fetch_instance_info(self, filter, **options): def search_instance(self, filter, page, **options): """ - 项目暂时不支持任何搜索 + 根据项目名称进行搜索,同时匹配 key 和 name 字段 """ - queryset = self.queryset.filter(key__contains=filter.keyword) + queryset = self.queryset.filter( + Q(name__icontains=filter.keyword) | Q(key__icontains=filter.keyword) + ) count = queryset.count() results = [ {"id": project.key, "display_name": project.name}