Perf: avoid unnecessary full-row fetches in batch permission assignment

set_permissions_for_objects now takes a model + pks instead of instances,
and identity filtering resolves straight to ids, so bulk-editing
permissions no longer materializes full Document/User/Group rows just to
read their pk/id. Row construction for bulk_create is also chunked to
bound peak memory for very large "apply to all" operations.
This commit is contained in:
stumpylog
2026-08-25 09:27:24 -07:00
parent 8780bcd5c7
commit cbac71c165
4 changed files with 45 additions and 19 deletions
+2 -1
View File
@@ -636,7 +636,8 @@ class TestBulkEdit(DirectoriesMixin, TestCase):
with self.assertRaises(Permission.DoesNotExist):
set_permissions_for_objects(
{"not_a_real_action": {"users": [self.user1.id], "groups": []}},
[self.doc1],
Document,
[self.doc1.pk],
)
@mock.patch("documents.models.Document.delete")