fix - optimize user relation list
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
# Django secrets
|
||||
SECRET_KEY=django-insecure-@0apn-lk85pfw=z00x2ib$w9#rwz8%2v4i_n^^9jz-m9b+y55*
|
||||
DEBUG=True
|
||||
DEBUG=False
|
||||
ALLOWED_HOSTS=localhost,127.0.0.1,https://rasadyar.net/,https://localhost:9200,https://api.rasadyaar.net,https://api.dam.rasadyaar.net',https://dam.rasadyar.net',http://localhost:3000',http://192.168.88.130:3000',https://rasaddam-front.liara.run',ns0ck4ksk0koks8ksw0ss08g.31.7.78.133.sslip.io' # noqa
|
||||
ENV_NAME=DEV
|
||||
|
||||
# Database secrets
|
||||
DB_HOST=31.7.78.133
|
||||
DB_PORT=14352
|
||||
DB_NAME=Development
|
||||
DB_NAME=Production
|
||||
DB_USERNAME=postgres
|
||||
DB_PASSWORD=pfLIVXupbDetvFMt2gUvxLXUL9b4HIOHaPcKXsBEZ1i8zl0iLUjmhUfXlGfJKcTV
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ class UserRelationViewSet(BaseViewSet, SoftDeleteMixin, viewsets.ModelViewSet, D
|
||||
queryset = self.get_queryset(
|
||||
visibility_by_org_scope=True
|
||||
) if org.free_visibility_by_scope else self.get_queryset()
|
||||
|
||||
print(queryset)
|
||||
if role_param != '':
|
||||
queryset = queryset.filter(role_id=int(role_param))
|
||||
else:
|
||||
|
||||
@@ -145,9 +145,9 @@ class UserRelationSerializer(serializers.ModelSerializer):
|
||||
if instance.user:
|
||||
representation['user'] = auth_serializer.UserSerializer(instance.user).data
|
||||
if instance.organization:
|
||||
representation['organization'] = auth_serializer.OrganizationSerializer(instance.organization).data
|
||||
representation['organization'] = {"id": instance.organization.id, "name": instance.organization.name}
|
||||
if instance.role:
|
||||
representation['role'] = RoleSerializer(instance.role).data
|
||||
representation['role'] = {"id": instance.role.id, "name": instance.role.role_name}
|
||||
if instance.permissions: # noqa
|
||||
# set permissions by a default structure like:
|
||||
# 'page permission':[element permissions]
|
||||
|
||||
@@ -27,6 +27,7 @@ class BaseViewSet(RegionFilterMixin, viewsets.ModelViewSet):
|
||||
if visibility_by_org_scope:
|
||||
""" if organization has free visibility by scope, apply visibility filter """
|
||||
queryset = apply_visibility_filter(queryset, org)
|
||||
print("ssssssssssssss")
|
||||
return queryset
|
||||
|
||||
if user_relation.exists():
|
||||
|
||||
@@ -3,7 +3,7 @@ from rest_framework.response import Response
|
||||
|
||||
|
||||
class CustomPageNumberPagination(PageNumberPagination):
|
||||
page_size = 20 # default
|
||||
page_size = 5 # default
|
||||
page_size_query_param = 'page_size' # set from client
|
||||
max_page_size = 100 # maximum items to show
|
||||
message = None
|
||||
|
||||
Reference in New Issue
Block a user