fix: 修复一些 Root 组织没数据的问题

This commit is contained in:
xinwen
2021-03-18 16:44:32 +08:00
committed by Jiangjie.Bai
parent 33952b2333
commit b597cfcd19
3 changed files with 6 additions and 5 deletions

View File

@@ -70,7 +70,7 @@ class OrgBulkModelViewSet(CommonApiMixin, OrgViewSetMixin, BulkModelViewSet):
class OrgRelationMixin(RelationMixin):
def get_queryset(self):
queryset = super().get_queryset()
org_id = current_org.org_id()
if org_id is not None:
if not current_org.is_root():
org_id = current_org.org_id()
queryset = queryset.filter(**{f'{self.from_field}__org_id': org_id})
return queryset