properly update item after removing selected video

This commit is contained in:
j 2014-03-09 16:45:13 +00:00
parent 5429b0d6b5
commit d8e20d9380

View file

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