perf(perms): 优化用户授权树返回org_name字段;添加thread_local属性org_mapper减少查询次数

This commit is contained in:
Bai
2020-11-26 19:18:06 +08:00
committed by Jiangjie.Bai
parent 6d427b9834
commit c3b09dd800
3 changed files with 35 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ from django.core.exceptions import ValidationError
from common.utils import get_logger
from ..utils import (
set_current_org, get_current_org, current_org,
filter_org_queryset
filter_org_queryset, get_org_name_by_id
)
from ..models import Organization
@@ -76,7 +76,7 @@ class OrgModelMixin(models.Model):
@property
def org_name(self):
return self.org.name
return get_org_name_by_id(self.org_id)
@property
def fullname(self, attr=None):