From 57d3fc0d32dc274950a13e052377d5f4b59b0813 Mon Sep 17 00:00:00 2001 From: j Date: Sat, 10 Jun 2023 13:01:43 +0100 Subject: [PATCH] don't store id in batch edits --- pandora/document/models.py | 2 ++ pandora/document/tasks.py | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pandora/document/models.py b/pandora/document/models.py index d76cac36..30006ecc 100644 --- a/pandora/document/models.py +++ b/pandora/document/models.py @@ -349,6 +349,8 @@ class Document(models.Model, FulltextMixin): groups = data.pop('groups') update_groups(self, groups) for key in data: + if key == "id": + continue k = list(filter(lambda i: i['id'] == key, settings.CONFIG['documentKeys'])) ktype = k and k[0].get('type') or '' if key == 'text' and self.extension == 'html': diff --git a/pandora/document/tasks.py b/pandora/document/tasks.py index 462dab96..dfd97d1c 100644 --- a/pandora/document/tasks.py +++ b/pandora/document/tasks.py @@ -18,7 +18,9 @@ def bulk_edit(data, username): from item.models import Item user = models.User.objects.get(username=username) item = 'item' in data and Item.objects.get(public_id=data['item']) or None - documents = models.Document.objects.filter(pk__in=map(ox.fromAZ, data['id'])) + ids = data['id'] + del data['id'] + documents = models.Document.objects.filter(pk__in=map(ox.fromAZ, ids)) for document in documents: if document.editable(user, item): with transaction.atomic():