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()
|
response = json_response()
|
||||||
if request.user.get_profile().get_level() == 'admin':
|
if request.user.get_profile().get_level() == 'admin':
|
||||||
qs = models.File.objects.filter(oshash__in=data['ids'], instances__id=None)
|
qs = models.File.objects.filter(oshash__in=data['ids'], instances__id=None)
|
||||||
for f in qs:
|
selected = set([f.item.id for f in qs if f.selected])
|
||||||
if f.item.sort.numberoffiles:
|
items = list(set([f.item.id for f in qs]))
|
||||||
f.item.sort.numberoffiles -= 1
|
print selected
|
||||||
f.item.sort.save()
|
print items
|
||||||
qs.delete()
|
qs.delete()
|
||||||
|
for i in Item.objects.filter(id__in=items):
|
||||||
|
if i.id in selected:
|
||||||
|
i.update_timeline()
|
||||||
|
else:
|
||||||
|
i.save()
|
||||||
else:
|
else:
|
||||||
response = json_response(status=403, text='permissino denied')
|
response = json_response(status=403, text='permissino denied')
|
||||||
return render_to_json_response(response)
|
return render_to_json_response(response)
|
||||||
|
|
Loading…
Reference in a new issue