perf: 优化树

This commit is contained in:
ibuler
2021-07-30 17:19:07 +08:00
committed by 老广
parent 66b0173e20
commit 5e4b3e924f
4 changed files with 24 additions and 20 deletions

View File

@@ -31,7 +31,7 @@ class ApplicationAccountViewSet(JMSModelViewSet):
permission_classes = (IsOrgAdmin, )
search_fields = ['username', 'app_name']
filterset_class = AccountFilterSet
filterset_fields = ['username', 'app_name', 'app_type', 'app_category']
filterset_fields = ['username', 'app_name', 'type', 'category']
serializer_class = serializers.ApplicationAccountSerializer
http_method_names = ['get', 'put', 'patch', 'options']
@@ -47,10 +47,8 @@ class ApplicationAccountViewSet(JMSModelViewSet):
.annotate(password=F('system_users__password')) \
.annotate(app=F('applications')) \
.annotate(app_name=F("applications__name")) \
.annotate(app_category=F("applications__category")) \
.annotate(app_type=F("applications__type"))\
.values('username', 'password', 'systemuser', 'systemuser_display',
'app', 'app_name', 'app_category', 'app_type', 'uid')
'app', 'app_name', 'category', 'type', 'uid')
return queryset
def get_object(self):