properly update item after removing selected video
This commit is contained in:
parent
5429b0d6b5
commit
d8e20d9380
1 changed files with 9 additions and 4 deletions
|
@ -456,11 +456,16 @@ def removeMedia(request):
|
|||
response = json_response()
|
||||
if request.user.get_profile().get_level() == 'admin':
|
||||
qs = models.File.objects.filter(oshash__in=data['ids'], instances__id=None)
|
||||
for f in qs:
|
||||
if f.item.sort.numberoffiles:
|
||||
f.item.sort.numberoffiles -= 1
|
||||
f.item.sort.save()
|
||||
selected = set([f.item.id for f in qs if f.selected])
|
||||
items = list(set([f.item.id for f in qs]))
|
||||
print selected
|
||||
print items
|
||||
qs.delete()
|
||||
for i in Item.objects.filter(id__in=items):
|
||||
if i.id in selected:
|
||||
i.update_timeline()
|
||||
else:
|
||||
i.save()
|
||||
else:
|
||||
response = json_response(status=403, text='permissino denied')
|
||||
return render_to_json_response(response)
|
||||
|
|
Loading…
Reference in a new issue