Loading rpc/methods.py +19 −4 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ def collections( only_published: bool = False, project_id: int = None, order_by: str = "title", only_deleted_items: bool = False, ) -> List[Dict]: """ Return the user's collections under the parent collection Loading Loading @@ -295,7 +296,7 @@ def collections( else: parent = Collection.objects.get( pk=parent_id, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, project__projectaccess__user=user, project__projectaccess__role__permissions__label=PERM_COLLECTION_READ, ) Loading @@ -317,14 +318,14 @@ def collections( if flat_list: query_set: Union[Iterator[Collection], QuerySet] = Collection.objects.filter( project_id=project_id, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, project__projectaccess__user=user, project__projectaccess__role__permissions__label=PERM_COLLECTION_READ, ).order_by(order_by) else: query_set: Union[Iterator[Collection], QuerySet] = Collection.objects.filter( parent=parent, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, project_id=project_id, project__projectaccess__user=user, project__projectaccess__role__permissions__label=PERM_COLLECTION_READ, Loading Loading @@ -704,6 +705,7 @@ def resources( limit_from: int = 0, limit_to: int = 2000, order_by: str = "title", only_deleted_items: bool = False, ) -> List[Dict]: """ Get all resources from a collection. Loading Loading @@ -764,7 +766,7 @@ def resources( return [] query_set: Union[Iterator[Resource], QuerySet] = Resource.objects.filter( collections__id=collection_id, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, ptr_project__projectaccess__user=user, ptr_project__projectaccess__role__permissions__label=PERM_RESOURCE_READ, ).order_by(order_by) Loading Loading @@ -983,6 +985,7 @@ def advanced_search( {"property": "title", "term": "contains", "value": "cherbourg"}, {"meta": 123, "term": "is", "value": "35mm"}, {"tags": ["PAINTINGS", "PHOTOS"]} {"exclude_tags": ["DRAWINGS"]} ] ``` Loading Loading @@ -1054,6 +1057,10 @@ def advanced_search( ) elif "tags" in search_term: resources_set = resources_set.filter(tags__uid__in=search_term["tags"]) elif "exclude_tags" in search_term: resources_set = resources_set.exclude( tags__uid__in=search_term["exclude_tags"] ) for resource_instance in resources_set.distinct(): results["resources"].append( serializers.resource(resource_instance, include_metas=include_metas) Loading Loading @@ -1100,6 +1107,10 @@ def advanced_search( ) elif "tags" in search_term: collections_set = collections_set.filter(tags__uid__in=search_term["tags"]) elif "exclude_tags" in search_term: collections_set = collections_set.exclude( tags__uid__in=search_term["exclude_tags"] ) for collection_instance in collections_set.distinct(): results["collections"].append(serializers.collection(collection_instance)) Loading Loading @@ -2283,3 +2294,7 @@ def collection_stats(user: User, collection_id: int) -> dict: deleted_at__isnull=True ).count(), } def recycle_bin(user: User, project_id: int) -> List[Dict]: pass Loading
rpc/methods.py +19 −4 Original line number Diff line number Diff line Loading @@ -243,6 +243,7 @@ def collections( only_published: bool = False, project_id: int = None, order_by: str = "title", only_deleted_items: bool = False, ) -> List[Dict]: """ Return the user's collections under the parent collection Loading Loading @@ -295,7 +296,7 @@ def collections( else: parent = Collection.objects.get( pk=parent_id, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, project__projectaccess__user=user, project__projectaccess__role__permissions__label=PERM_COLLECTION_READ, ) Loading @@ -317,14 +318,14 @@ def collections( if flat_list: query_set: Union[Iterator[Collection], QuerySet] = Collection.objects.filter( project_id=project_id, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, project__projectaccess__user=user, project__projectaccess__role__permissions__label=PERM_COLLECTION_READ, ).order_by(order_by) else: query_set: Union[Iterator[Collection], QuerySet] = Collection.objects.filter( parent=parent, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, project_id=project_id, project__projectaccess__user=user, project__projectaccess__role__permissions__label=PERM_COLLECTION_READ, Loading Loading @@ -704,6 +705,7 @@ def resources( limit_from: int = 0, limit_to: int = 2000, order_by: str = "title", only_deleted_items: bool = False, ) -> List[Dict]: """ Get all resources from a collection. Loading Loading @@ -764,7 +766,7 @@ def resources( return [] query_set: Union[Iterator[Resource], QuerySet] = Resource.objects.filter( collections__id=collection_id, deleted_at__isnull=True, deleted_at__isnull=not only_deleted_items, ptr_project__projectaccess__user=user, ptr_project__projectaccess__role__permissions__label=PERM_RESOURCE_READ, ).order_by(order_by) Loading Loading @@ -983,6 +985,7 @@ def advanced_search( {"property": "title", "term": "contains", "value": "cherbourg"}, {"meta": 123, "term": "is", "value": "35mm"}, {"tags": ["PAINTINGS", "PHOTOS"]} {"exclude_tags": ["DRAWINGS"]} ] ``` Loading Loading @@ -1054,6 +1057,10 @@ def advanced_search( ) elif "tags" in search_term: resources_set = resources_set.filter(tags__uid__in=search_term["tags"]) elif "exclude_tags" in search_term: resources_set = resources_set.exclude( tags__uid__in=search_term["exclude_tags"] ) for resource_instance in resources_set.distinct(): results["resources"].append( serializers.resource(resource_instance, include_metas=include_metas) Loading Loading @@ -1100,6 +1107,10 @@ def advanced_search( ) elif "tags" in search_term: collections_set = collections_set.filter(tags__uid__in=search_term["tags"]) elif "exclude_tags" in search_term: collections_set = collections_set.exclude( tags__uid__in=search_term["exclude_tags"] ) for collection_instance in collections_set.distinct(): results["collections"].append(serializers.collection(collection_instance)) Loading Loading @@ -2283,3 +2294,7 @@ def collection_stats(user: User, collection_id: int) -> dict: deleted_at__isnull=True ).count(), } def recycle_bin(user: User, project_id: int) -> List[Dict]: pass