From f4b5a302a197131dec356ef6df2693d74e9ca758 Mon Sep 17 00:00:00 2001 From: ibuler Date: Fri, 16 Jun 2023 16:44:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E8=B5=84=E4=BA=A7=E6=A0=B9=E6=8D=AE=E5=8D=8F=E8=AE=AE=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E9=87=8D=E5=A4=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/assets/api/asset/asset.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/assets/api/asset/asset.py b/apps/assets/api/asset/asset.py index 82733b03e..81b2b8fca 100644 --- a/apps/assets/api/asset/asset.py +++ b/apps/assets/api/asset/asset.py @@ -82,7 +82,7 @@ class AssetFilterSet(BaseFilterSet): @staticmethod def filter_protocols(queryset, name, value): value = value.split(',') - return queryset.filter(protocols__name__in=value) + return queryset.filter(protocols__name__in=value).distinct() @staticmethod def filter_labels(queryset, name, value): @@ -91,7 +91,7 @@ class AssetFilterSet(BaseFilterSet): queryset = queryset.filter(labels__name=n, labels__value=v) else: q = Q(labels__name__contains=value) | Q(labels__value__contains=value) - queryset = queryset.filter(q) + queryset = queryset.filter(q).distinct() return queryset