perf: 修复应用账号选择部分导出问题

pull/6664/head
ibuler 3 years ago committed by Jiangjie.Bai
parent 5cd23b843a
commit 1605a57df6

@ -63,6 +63,11 @@ class ApplicationAccountViewSet(JMSModelViewSet):
queryset_list = unique(queryset, key=lambda x: (x['app'], x['systemuser']))
return queryset_list
@staticmethod
def filter_spm_queryset(resource_ids, queryset):
queryset = queryset.filter(uid__in=resource_ids)
return queryset
class ApplicationAccountSecretViewSet(ApplicationAccountViewSet):
serializer_class = serializers.ApplicationAccountSecretSerializer

@ -112,7 +112,10 @@ class IDSpmFilter(filters.BaseFilterBackend):
resource_ids = cache.get(cache_key)
if resource_ids is None or not isinstance(resource_ids, list):
return queryset
queryset = queryset.filter(id__in=resource_ids)
if hasattr(view, 'filter_spm_queryset'):
queryset = view.filter_spm_queryset(resource_ids, queryset)
else:
queryset = queryset.filter(id__in=resource_ids)
return queryset

Loading…
Cancel
Save