mirror of https://github.com/jumpserver/jumpserver
fix: 修复授权资产根据协议搜索重复的问题
parent
dd955530f1
commit
f4b5a302a1
|
@ -82,7 +82,7 @@ class AssetFilterSet(BaseFilterSet):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def filter_protocols(queryset, name, value):
|
def filter_protocols(queryset, name, value):
|
||||||
value = value.split(',')
|
value = value.split(',')
|
||||||
return queryset.filter(protocols__name__in=value)
|
return queryset.filter(protocols__name__in=value).distinct()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def filter_labels(queryset, name, value):
|
def filter_labels(queryset, name, value):
|
||||||
|
@ -91,7 +91,7 @@ class AssetFilterSet(BaseFilterSet):
|
||||||
queryset = queryset.filter(labels__name=n, labels__value=v)
|
queryset = queryset.filter(labels__name=n, labels__value=v)
|
||||||
else:
|
else:
|
||||||
q = Q(labels__name__contains=value) | Q(labels__value__contains=value)
|
q = Q(labels__name__contains=value) | Q(labels__value__contains=value)
|
||||||
queryset = queryset.filter(q)
|
queryset = queryset.filter(q).distinct()
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue