don't store id in batch edits

This commit is contained in:
j 2023-06-10 13:01:43 +01:00
parent 0d70326aa8
commit 57d3fc0d32
2 changed files with 5 additions and 1 deletions

View file

@ -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':

View file

@ -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():