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

@@ -19,9 +19,10 @@ __all__ = [
class RelationMixin:
def get_queryset(self):
queryset = self.model.objects.all()
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(systemuser__org_id=org_id)
queryset = queryset.annotate(systemuser_display=Concat(
F('systemuser__name'), Value('('), F('systemuser__username'),
Value(')')