From d8e20d9380fa37a369354508b73e8e62c0bca2a3 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 9 Mar 2014 16:45:13 +0000 Subject: [PATCH] properly update item after removing selected video --- pandora/archive/views.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pandora/archive/views.py b/pandora/archive/views.py index a1d6278b..1455bdfb 100644 --- a/pandora/archive/views.py +++ b/pandora/archive/views.py @@ -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)