don't store id in batch edits
This commit is contained in:
parent
0d70326aa8
commit
57d3fc0d32
2 changed files with 5 additions and 1 deletions
|
@ -349,6 +349,8 @@ class Document(models.Model, FulltextMixin):
|
||||||
groups = data.pop('groups')
|
groups = data.pop('groups')
|
||||||
update_groups(self, groups)
|
update_groups(self, groups)
|
||||||
for key in data:
|
for key in data:
|
||||||
|
if key == "id":
|
||||||
|
continue
|
||||||
k = list(filter(lambda i: i['id'] == key, settings.CONFIG['documentKeys']))
|
k = list(filter(lambda i: i['id'] == key, settings.CONFIG['documentKeys']))
|
||||||
ktype = k and k[0].get('type') or ''
|
ktype = k and k[0].get('type') or ''
|
||||||
if key == 'text' and self.extension == 'html':
|
if key == 'text' and self.extension == 'html':
|
||||||
|
|
|
@ -18,7 +18,9 @@ def bulk_edit(data, username):
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
user = models.User.objects.get(username=username)
|
user = models.User.objects.get(username=username)
|
||||||
item = 'item' in data and Item.objects.get(public_id=data['item']) or None
|
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:
|
for document in documents:
|
||||||
if document.editable(user, item):
|
if document.editable(user, item):
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
|
|
Loading…
Reference in a new issue