fix - show org type by binary childs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from rest_framework import viewsets
|
||||
|
||||
from apps.authentication.mixins.region_filter import RegionFilterMixin, get_organization_by_user
|
||||
from apps.authentication.services.service import get_all_org_child
|
||||
from apps.authentication.services.service import get_all_org_child, get_all_org_type_child
|
||||
from apps.authentication.services.visibility_services import apply_visibility_filter
|
||||
from apps.authorization.services.role_child import get_all_role_child
|
||||
from apps.core.models import MobileTest, SystemConfig
|
||||
@@ -50,9 +50,12 @@ class BaseViewSet(RegionFilterMixin, viewsets.ModelViewSet):
|
||||
elif model_name == 'organization':
|
||||
queryset = queryset.filter(id__in=[org.id for org in child_orgs])
|
||||
|
||||
elif model_name == 'organizationtype': # noqa
|
||||
|
||||
queryset = queryset.filter(id__in=[org_type.id for org_type in get_all_org_type_child(org.type)])
|
||||
|
||||
elif model_name == 'role':
|
||||
queryset = queryset.filter(id__in=[role.id for role in get_all_role_child(user_relation.role)])
|
||||
|
||||
return queryset
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user