fix: 修复终端列表根据负载状态进行过滤

pull/9376/head
Bai 2023-01-31 15:00:02 +08:00 committed by Jiangjie.Bai
parent 43353c257e
commit 229e89af03
1 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ class TerminalViewSet(JMSBulkModelViewSet):
queryset = Terminal.objects.filter(is_deleted=False)
serializer_class = serializers.TerminalSerializer
filterset_fields = ['name', 'remote_addr', 'type']
custom_filter_fields = ['status']
custom_filter_fields = ['load']
def destroy(self, request, *args, **kwargs):
instance = self.get_object()
@ -40,7 +40,7 @@ class TerminalViewSet(JMSBulkModelViewSet):
def filter_queryset(self, queryset):
queryset = super().filter_queryset(queryset)
s = self.request.query_params.get('status')
s = self.request.query_params.get('load')
if not s:
return queryset
filtered_queryset_id = [str(q.id) for q in queryset if q.load == s]