better results for batch edit
This commit is contained in:
parent
4ed4926bd8
commit
ef9b13b310
1 changed files with 5 additions and 0 deletions
|
@ -128,6 +128,7 @@ def edit(data):
|
||||||
ids = data['id']
|
ids = data['id']
|
||||||
if isinstance(ids, str):
|
if isinstance(ids, str):
|
||||||
ids = [ids]
|
ids = [ids]
|
||||||
|
edited = []
|
||||||
for id in ids:
|
for id in ids:
|
||||||
item = models.Item.get(id)
|
item = models.Item.get(id)
|
||||||
if item and item.json()['mediastate'] == 'available':
|
if item and item.json()['mediastate'] == 'available':
|
||||||
|
@ -143,8 +144,12 @@ def edit(data):
|
||||||
else:
|
else:
|
||||||
item.edit_metadata(data)
|
item.edit_metadata(data)
|
||||||
response = item.json()
|
response = item.json()
|
||||||
|
edited.append(id)
|
||||||
else:
|
else:
|
||||||
logger.info('can only edit available items %s', id)
|
logger.info('can only edit available items %s', id)
|
||||||
|
if len(ids) > 1:
|
||||||
|
response = data
|
||||||
|
response['id'] = edited
|
||||||
return response
|
return response
|
||||||
actions.register(edit, cache=False)
|
actions.register(edit, cache=False)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue