A community-supported supercharged document management system: scan, index and archive all your documents
Python aiangulararchivingdjangodmsdocument-managementdocument-management-systemllmmachine-learningocroptical-character-recognitionpdf
Fix shared by me filter with multiple users / groups in postgres (#5396)
shamoon783090c2cd53
diff --git a/src/documents/filters.py b/src/documents/filters.pyindex bab20a4dc..b760b9779 100644--- a/src/documents/filters.py+++ b/src/documents/filters.py@@ -114,6 +114,8 @@ class SharedByUser(Filter):ctype = ContentType.objects.get_for_model(self.model)UserObjectPermission = get_user_obj_perms_model()GroupObjectPermission = get_group_obj_perms_model()+ # see https://github.com/paperless-ngx/paperless-ngx/issues/5392, we limit subqueries+ # to 1 because Postgres doesn't like returning > 1 row, but all we care about is > 0return (qs.filter(owner_id=value,@@ -123,7 +125,7 @@ class SharedByUser(Filter):UserObjectPermission.objects.filter(content_type=ctype,object_pk=Cast(OuterRef("pk"), CharField()),- ).values("user_id"),+ ).values("user_id")[:1],),).annotate(@@ -131,7 +133,7 @@ class SharedByUser(Filter):GroupObjectPermission.objects.filter(content_type=ctype,object_pk=Cast(OuterRef("pk"), CharField()),- ).values("group_id"),+ ).values("group_id")[:1],),).filter(