文件选择器添加系统内置文件筛选(功能未完善)

This commit is contained in:
阿辉
2024-12-02 19:53:04 +08:00
parent 547cc30818
commit e880af6f1e
3 changed files with 47 additions and 14 deletions

View File

@@ -100,3 +100,12 @@ class FileViewSet(CustomModelViewSet):
@action(methods=['GET'], detail=False)
def get_all(self, request):
return DetailResponse(data=self.get_serializer(self.get_queryset(), many=True).data)
def get_queryset(self):
if self.request.query_params.get('system', 'False') == 'True' and dispatch.is_tenants_mode():
from django_tenants.utils import tenant_context, get_tenant_model
with tenant_context(get_tenant_model().objects.filter(schema_name='public').first()):
print('系统内置文件')
return super().get_queryset()
print('常规文件')
return super().get_queryset()