fix - change get_queryset flag
This commit is contained in:
@@ -24,6 +24,7 @@ from apps.core.api import BaseViewSet
|
||||
from apps.core.exceptions import ConflictException
|
||||
from apps.core.mixins.search_mixin import DynamicSearchMixin
|
||||
from apps.core.mixins.soft_delete_mixin import SoftDeleteMixin
|
||||
from common.helpers import get_organization_by_user
|
||||
|
||||
|
||||
class RoleViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet):
|
||||
@@ -164,10 +165,16 @@ class UserRelationViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, D
|
||||
def list(self, request, *args, **kwargs):
|
||||
role_param = self.request.query_params.get('role') # noqa
|
||||
|
||||
org = get_organization_by_user(request.user)
|
||||
|
||||
queryset = self.get_queryset(
|
||||
visibility_by_org_scope=True
|
||||
) if org.free_visibility_by_scope else self.get_queryset()
|
||||
|
||||
if role_param != '':
|
||||
queryset = self.get_queryset(visibility_by_org_scope=True).filter(role_id=int(role_param))
|
||||
queryset = queryset.filter(role_id=int(role_param))
|
||||
else:
|
||||
queryset = self.get_queryset(visibility_by_org_scope=True).order_by('-create_date')
|
||||
queryset = queryset.order_by('-create_date')
|
||||
|
||||
queryset = self.filter_queryset(queryset) # noqa
|
||||
|
||||
|
||||
Reference in New Issue
Block a user